New patches from Fedora.
[fedora-mingw.git] / libssh2 / libssh2-04-non-blocking-examples.patch
1 diff -urN libssh2-0.18.orig/example/simple/scp_nonblock.c libssh2-0.18.mingw/example/simple/scp_nonblock.c
2 --- libssh2-0.18.orig/example/simple/scp_nonblock.c     2007-09-24 13:15:45.000000000 +0100
3 +++ libssh2-0.18.mingw/example/simple/scp_nonblock.c    2008-11-10 14:22:21.000000000 +0000
4 @@ -89,8 +89,13 @@
5      rc = fcntl(sock, F_GETFL, 0);
6      fcntl(sock, F_SETFL, rc | O_NONBLOCK);
7  #else
8 +#ifdef WIN32
9 +    u_long mode = 1;
10 +    ioctlsocket (sock, FIONBIO, &mode);
11 +#else
12  #error "add support for setting the socket non-blocking here"
13  #endif
14 +#endif
15  
16      /* Create a session instance */
17      session = libssh2_session_init();
18 diff -urN libssh2-0.18.orig/example/simple/scp_write_nonblock.c libssh2-0.18.mingw/example/simple/scp_write_nonblock.c
19 --- libssh2-0.18.orig/example/simple/scp_write_nonblock.c       2007-08-12 22:39:56.000000000 +0100
20 +++ libssh2-0.18.mingw/example/simple/scp_write_nonblock.c      2008-11-10 14:22:13.000000000 +0000
21 @@ -106,8 +106,13 @@
22      rc = fcntl(sock, F_GETFL, 0);
23      fcntl(sock, F_SETFL, rc | O_NONBLOCK);
24  #else
25 +#ifdef WIN32
26 +    u_long mode = 1;
27 +    ioctlsocket (sock, FIONBIO, &mode);
28 +#else
29  #error "add support for setting the socket non-blocking here"
30  #endif
31 +#endif
32  
33      /* Create a session instance
34       */
35 diff -urN libssh2-0.18.orig/example/simple/sftpdir_nonblock.c libssh2-0.18.mingw/example/simple/sftpdir_nonblock.c
36 --- libssh2-0.18.orig/example/simple/sftpdir_nonblock.c 2007-08-12 22:39:56.000000000 +0100
37 +++ libssh2-0.18.mingw/example/simple/sftpdir_nonblock.c        2008-11-10 14:23:35.000000000 +0000
38 @@ -92,8 +92,13 @@
39      rc = fcntl(sock, F_GETFL, 0);
40      fcntl(sock, F_SETFL, rc | O_NONBLOCK);
41  #else
42 +#ifdef WIN32
43 +    u_long mode = 1;
44 +    ioctlsocket (sock, FIONBIO, &mode);
45 +#else
46  #error "add support for setting the socket non-blocking here"
47  #endif
48 +#endif
49  
50      /* Create a session instance
51       */
52 diff -urN libssh2-0.18.orig/example/simple/sftp_mkdir_nonblock.c libssh2-0.18.mingw/example/simple/sftp_mkdir_nonblock.c
53 --- libssh2-0.18.orig/example/simple/sftp_mkdir_nonblock.c      2007-08-12 22:39:56.000000000 +0100
54 +++ libssh2-0.18.mingw/example/simple/sftp_mkdir_nonblock.c     2008-11-10 14:23:03.000000000 +0000
55 @@ -92,8 +92,13 @@
56      rc = fcntl(sock, F_GETFL, 0);
57      fcntl(sock, F_SETFL, rc | O_NONBLOCK);
58  #else
59 +#ifdef WIN32
60 +    u_long mode = 1;
61 +    ioctlsocket (sock, FIONBIO, &mode);
62 +#else
63  #error "add support for setting the socket non-blocking here"
64  #endif
65 +#endif
66  
67      /* Create a session instance
68       */
69 diff -urN libssh2-0.18.orig/example/simple/sftp_nonblock.c libssh2-0.18.mingw/example/simple/sftp_nonblock.c
70 --- libssh2-0.18.orig/example/simple/sftp_nonblock.c    2007-08-12 22:39:56.000000000 +0100
71 +++ libssh2-0.18.mingw/example/simple/sftp_nonblock.c   2008-11-10 14:22:30.000000000 +0000
72 @@ -95,8 +95,13 @@
73      rc = fcntl(sock, F_GETFL, 0);
74      fcntl(sock, F_SETFL, rc | O_NONBLOCK);
75  #else
76 +#ifdef WIN32
77 +    u_long mode = 1;
78 +    ioctlsocket (sock, FIONBIO, &mode);
79 +#else
80  #error "add support for setting the socket non-blocking here"
81  #endif
82 +#endif
83  
84      /* Create a session instance */
85      session = libssh2_session_init();
86 diff -urN libssh2-0.18.orig/example/simple/sftp_RW_nonblock.c libssh2-0.18.mingw/example/simple/sftp_RW_nonblock.c
87 --- libssh2-0.18.orig/example/simple/sftp_RW_nonblock.c 2007-08-12 22:39:56.000000000 +0100
88 +++ libssh2-0.18.mingw/example/simple/sftp_RW_nonblock.c        2008-11-10 14:23:18.000000000 +0000
89 @@ -88,8 +88,13 @@
90      rc = fcntl(sock, F_GETFL, 0);
91      fcntl(sock, F_SETFL, rc | O_NONBLOCK);
92  #else
93 +#ifdef WIN32
94 +    u_long mode = 1;
95 +    ioctlsocket (sock, FIONBIO, &mode);
96 +#else
97  #error "add support for setting the socket non-blocking here"
98  #endif
99 +#endif
100  
101      /* Create a session instance
102       */
103 diff -urN libssh2-0.18.orig/example/simple/sftp_write_nonblock.c libssh2-0.18.mingw/example/simple/sftp_write_nonblock.c
104 --- libssh2-0.18.orig/example/simple/sftp_write_nonblock.c      2007-08-12 22:39:56.000000000 +0100
105 +++ libssh2-0.18.mingw/example/simple/sftp_write_nonblock.c     2008-11-10 14:22:44.000000000 +0000
106 @@ -107,8 +107,13 @@
107      rc = fcntl(sock, F_GETFL, 0);
108      fcntl(sock, F_SETFL, rc | O_NONBLOCK);
109  #else
110 +#ifdef WIN32
111 +    u_long mode = 1;
112 +    ioctlsocket (sock, FIONBIO, &mode);
113 +#else
114  #error "add support for setting the socket non-blocking here"
115  #endif
116 +#endif
117  
118      /* Create a session instance
119          */