Lines 1-147
Link Here
|
1 |
--- sshfs.c.orig Fri Oct 28 08:15:35 2005 |
|
|
2 |
+++ sshfs.c Mon Oct 31 02:59:33 2005 |
3 |
@@ -14,7 +14,11 @@ |
4 |
#include <unistd.h> |
5 |
#include <fcntl.h> |
6 |
#include <string.h> |
7 |
-#include <stdint.h> |
8 |
+#ifdef HAVE_STDINT_H |
9 |
+ #include <stdint.h> |
10 |
+#elif defined(HAVE_INTTYPES_H) |
11 |
+ #include <inttypes.h> |
12 |
+#endif |
13 |
#include <errno.h> |
14 |
#include <semaphore.h> |
15 |
#include <pthread.h> |
16 |
@@ -24,6 +28,13 @@ |
17 |
#include <sys/wait.h> |
18 |
#include <netinet/in.h> |
19 |
#include <glib.h> |
20 |
+#ifdef __FreeBSD__ |
21 |
+ #include <sys/socket.h> |
22 |
+ #include <sys/param.h> |
23 |
+ #if (__FreeBSD_version < 600034) |
24 |
+ #define EPROTONOSUPPORT 43 |
25 |
+ #endif |
26 |
+#endif |
27 |
|
28 |
#include "cache.h" |
29 |
#include "opts.h" |
30 |
@@ -1070,7 +1081,11 @@ |
31 |
err = req->error; |
32 |
goto out; |
33 |
} |
34 |
+#ifdef EPROTO |
35 |
err = -EPROTO; |
36 |
+#else |
37 |
+ err = -EPROTONOSUPPORT; |
38 |
+#endif |
39 |
if (req->reply_type != expect_type && req->reply_type != SSH_FXP_STATUS) { |
40 |
fprintf(stderr, "protocol error\n"); |
41 |
goto out; |
42 |
@@ -1085,21 +1100,35 @@ |
43 |
if (expect_type == SSH_FXP_STATUS) |
44 |
err = 0; |
45 |
else |
46 |
+#ifdef EPROTO |
47 |
err = -EPROTO; |
48 |
+#else |
49 |
+ err = -EPROTONOSUPPORT; |
50 |
+#endif |
51 |
break; |
52 |
|
53 |
case SSH_FX_EOF: |
54 |
if (type == SSH_FXP_READ || type == SSH_FXP_READDIR) |
55 |
err = MY_EOF; |
56 |
else |
57 |
+#ifdef EPROTO |
58 |
err = -EPROTO; |
59 |
+#else |
60 |
+ err = -EPROTONOSUPPORT; |
61 |
+#endif |
62 |
break; |
63 |
|
64 |
case SSH_FX_NO_SUCH_FILE: err = -ENOENT; break; |
65 |
case SSH_FX_PERMISSION_DENIED: err = -EACCES; break; |
66 |
case SSH_FX_FAILURE: err = -EPERM; break; |
67 |
case SSH_FX_BAD_MESSAGE: |
68 |
- default: err = -EPROTO; break; |
69 |
+ default: |
70 |
+#ifdef EPROTO |
71 |
+ err = -EPROTO; |
72 |
+#else |
73 |
+ err = -EPROTONOSUPPORT; |
74 |
+#endif |
75 |
+ break; |
76 |
} |
77 |
} else { |
78 |
buf_init(outbuf, req->reply.size - req->reply.len); |
79 |
@@ -1142,7 +1171,11 @@ |
80 |
err = sftp_request(SSH_FXP_LSTAT, &buf, SSH_FXP_ATTRS, &outbuf); |
81 |
if (!err) { |
82 |
if (buf_get_attrs(&outbuf, stbuf, NULL) == -1) |
83 |
+#ifdef EPROTO |
84 |
err = -EPROTO; |
85 |
+#else |
86 |
+ err = -EPROTONOSUPPORT; |
87 |
+#endif |
88 |
buf_free(&outbuf); |
89 |
} |
90 |
buf_free(&buf); |
91 |
@@ -1164,7 +1197,11 @@ |
92 |
if (!err) { |
93 |
uint32_t count; |
94 |
char *link; |
95 |
+#ifdef EPROTO |
96 |
err = -EPROTO; |
97 |
+#else |
98 |
+ err = -EPROTONOSUPPORT; |
99 |
+#endif |
100 |
if(buf_get_uint32(&name, &count) != -1 && count == 1 && |
101 |
buf_get_string(&name, &link) != -1) { |
102 |
strncpy(linkbuf, link, size-1); |
103 |
@@ -1195,7 +1232,11 @@ |
104 |
err = sftp_request(SSH_FXP_READDIR, &handle, SSH_FXP_NAME, &name); |
105 |
if (!err) { |
106 |
if (buf_get_entries(&name, h, filler) == -1) |
107 |
+#ifdef EPROTO |
108 |
err = -EPROTO; |
109 |
+#else |
110 |
+ err = -EPROTONOSUPPORT; |
111 |
+#endif |
112 |
buf_free(&name); |
113 |
} |
114 |
} while (!err); |
115 |
@@ -1528,7 +1569,11 @@ |
116 |
err = sftp_request(SSH_FXP_READ, &buf, SSH_FXP_DATA, &data); |
117 |
if (!err) { |
118 |
uint32_t retsize; |
119 |
+#ifdef EPROTO |
120 |
err = -EPROTO; |
121 |
+#else |
122 |
+ err = -EPROTONOSUPPORT; |
123 |
+#endif |
124 |
if (buf_get_uint32(&data, &retsize) != -1) { |
125 |
if (retsize > size) |
126 |
fprintf(stderr, "long read\n"); |
127 |
@@ -1550,7 +1595,11 @@ |
128 |
if (req->error) |
129 |
chunk->res = req->error; |
130 |
else if (req->replied) { |
131 |
+#ifdef EPROTO |
132 |
chunk->res = -EPROTO; |
133 |
+#else |
134 |
+ chunk->res = -EPROTONOSUPPORT; |
135 |
+#endif |
136 |
|
137 |
if (req->reply_type == SSH_FXP_STATUS) { |
138 |
uint32_t serr; |
139 |
@@ -1771,7 +1820,7 @@ |
140 |
{ |
141 |
(void) path; |
142 |
|
143 |
- buf->f_namelen = 255; |
144 |
+ buf->f_namemax = 255; |
145 |
buf->f_bsize = 512; |
146 |
buf->f_blocks = 999999999 * 2; |
147 |
buf->f_bfree = 999999999 * 2; |