1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

encode_multipart(): move @rd to inner scope.

This commit is contained in:
Laurent MONIN 2005-12-13 17:04:24 +01:00 committed by Laurent MONIN
parent 10aa67fb32
commit 1ca88c9147

View File

@ -784,7 +784,6 @@ encode_multipart(struct session *ses, struct list_head *l, struct string *data,
if (*sv->value) { if (*sv->value) {
unsigned char *filename; unsigned char *filename;
ssize_t rd;
if (get_cmd_opt_bool("anonymous")) { if (get_cmd_opt_bool("anonymous")) {
errno = EPERM; errno = EPERM;
@ -800,14 +799,21 @@ encode_multipart(struct session *ses, struct list_head *l, struct string *data,
if (fh == -1) goto encode_error; if (fh == -1) goto encode_error;
set_bin(fh); set_bin(fh);
do { while (1) {
rd = safe_read(fh, buffer, F_BUFLEN); ssize_t rd = safe_read(fh, buffer, F_BUFLEN);
if (rd == -1) {
close(fh); if (rd) {
goto encode_error; if (rd == -1) {
close(fh);
goto encode_error;
}
add_bytes_to_string(data, buffer, rd);
} else {
break;
} }
if (rd) add_bytes_to_string(data, buffer, rd); };
} while (rd);
close(fh); close(fh);
} }
#undef F_BUFLEN #undef F_BUFLEN