|
@@ -1060,10 +1060,10 @@ inet_send(int s, const void *msg, size_t len, int flags)
|
1060
|
1060
|
* it will just come back here to repeat the process as needed. */
|
1061
|
1061
|
case EMSGSIZE:
|
1062
|
1062
|
inet_send(s, msg, len/2, flags);
|
1063
|
|
- err=inet_send(s, (const char *)msg+(len/2),
|
1064
|
|
- len-(len/2), flags);
|
|
1063
|
+ err = inet_send(s, msg+(len/2), (len+1)/2);
|
|
1064
|
+
|
|
1065
|
+ printf("%lu", err);
|
1065
|
1066
|
break;
|
1066
|
|
-
|
1067
|
1067
|
default:
|
1068
|
1068
|
error("inet_send: Cannot send(): %s", strerror(errno));
|
1069
|
1069
|
return err;
|
|
@@ -1113,8 +1113,9 @@ inet_sendto(int s, const void *msg, size_t len, int flags,
|
1113
|
1113
|
switch (errno) {
|
1114
|
1114
|
case EMSGSIZE:
|
1115
|
1115
|
inet_sendto(s, msg, len/2, flags, to, tolen);
|
1116
|
|
- err=inet_sendto(s, (const char *)msg+(len/2),
|
1117
|
|
- len-(len/2), flags, to, tolen);
|
|
1116
|
+ err = inet_sendto(s, msg+(len/2), (len+1)/2, flags, to, tolen);
|
|
1117
|
+
|
|
1118
|
+ printf("%lu", err);
|
1118
|
1119
|
break;
|
1119
|
1120
|
case EFAULT:
|
1120
|
1121
|
/* Must be modified to accept IPv6 addresses
|
|
@@ -1172,5 +1173,23 @@ inet_sendfile(int out_fd, int in_fd, off_t * offset, size_t count)
|
1172
|
1173
|
|
1173
|
1174
|
if ((err = sendfile(out_fd, in_fd, offset, count)) == -1)
|
1174
|
1175
|
error("inet_sendfile: Cannot sendfile(): %s", strerror(errno));
|
|
1176
|
+ if (err < count) {
|
|
1177
|
+ count = count - err;
|
|
1178
|
+ err = inet_sendfile(out_fd, in_fd, offset, count);
|
|
1179
|
+ }
|
|
1180
|
+ return err;
|
|
1181
|
+}
|
|
1182
|
+
|
|
1183
|
+ssize_t
|
|
1184
|
+inet_sendfile64(int out_fd, int in_fd, off64_t * offset, size_t count)
|
|
1185
|
+{
|
|
1186
|
+ ssize_t err;
|
|
1187
|
+
|
|
1188
|
+ if ((err = sendfile64(out_fd, in_fd, offset, count)) == -1)
|
|
1189
|
+ error("inet_sendfile: Cannot sendfile(): %s", strerror(errno));
|
|
1190
|
+ if (err < count) {
|
|
1191
|
+ count = count - err;
|
|
1192
|
+ err = inet_sendfile64(out_fd, in_fd, offset, count);
|
|
1193
|
+ }
|
1175
|
1194
|
return err;
|
1176
|
1195
|
}
|