(sendmail_send_message): Bugfix: stream_read
should not use sendmail->offset for positioning.
Showing
1 changed file
with
3 additions
and
1 deletions
... | @@ -345,10 +345,11 @@ sendmail_send_message (mailer_t mailer, message_t msg, address_t from, | ... | @@ -345,10 +345,11 @@ sendmail_send_message (mailer_t mailer, message_t msg, address_t from, |
345 | char buffer[512]; | 345 | char buffer[512]; |
346 | size_t len = 0; | 346 | size_t len = 0; |
347 | int rc; | 347 | int rc; |
348 | size_t offset = 0; | ||
348 | 349 | ||
349 | message_get_stream (msg, &stream); | 350 | message_get_stream (msg, &stream); |
350 | while ((status = stream_read (stream, buffer, sizeof (buffer), | 351 | while ((status = stream_read (stream, buffer, sizeof (buffer), |
351 | sendmail->offset, &len)) == 0 | 352 | offset, &len)) == 0 |
352 | && len != 0) | 353 | && len != 0) |
353 | { | 354 | { |
354 | if (write (sendmail->fd, buffer, len) == -1) | 355 | if (write (sendmail->fd, buffer, len) == -1) |
... | @@ -360,6 +361,7 @@ sendmail_send_message (mailer_t mailer, message_t msg, address_t from, | ... | @@ -360,6 +361,7 @@ sendmail_send_message (mailer_t mailer, message_t msg, address_t from, |
360 | 361 | ||
361 | break; | 362 | break; |
362 | } | 363 | } |
364 | offset += len; | ||
363 | sendmail->offset += len; | 365 | sendmail->offset += len; |
364 | } | 366 | } |
365 | if (status == EAGAIN) | 367 | if (status == EAGAIN) | ... | ... |
-
Please register or sign in to post a comment