X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=imap-send.c;h=285ad29afb4c4126010ddc2f76963b4f8f1cce70;hb=7612a1efdb0c0806b43db10ce784707aae874340;hp=ea56dc9ae5e2110c88a3538a9559a6e6d0adb23c;hpb=1cd88cc9e6d6f83fed554419166a52a900e6f9a5;p=git.git diff --git a/imap-send.c b/imap-send.c index ea56dc9a..285ad29a 100644 --- a/imap-send.c +++ b/imap-send.c @@ -924,6 +924,7 @@ imap_open_store( imap_server_conf_t *srvc ) struct hostent *he; struct sockaddr_in addr; int s, a[2], preauth; + pid_t pid; ctx = xcalloc( sizeof(*ctx), 1 ); @@ -941,7 +942,10 @@ imap_open_store( imap_server_conf_t *srvc ) exit( 1 ); } - if (fork() == 0) { + pid = fork(); + if (pid < 0) + _exit( 127 ); + if (!pid) { if (dup2( a[0], 0 ) == -1 || dup2( a[0], 1 ) == -1) _exit( 127 ); close( a[0] ); @@ -1202,6 +1206,7 @@ read_message( FILE *f, msg_data_t *msg ) p = xrealloc(msg->data, len+1); if (!p) break; + msg->data = p; } r = fread( &msg->data[msg->len], 1, len - msg->len, f ); if (r <= 0)