#include <string.h>
#include <ctype.h>
+#include <errno.h>
ADDRESS *mutt_lookup_alias (const char *s)
{
recode_buf (buf, sizeof (buf));
write_safe_address (rc, buf);
fputc ('\n', rc);
- safe_fclose (&rc);
- mutt_message _("Alias added.");
+ if (safe_fsync_close(&rc) != 0)
+ mutt_message ("Trouble adding alias: %s.", strerror(errno));
+ else
+ mutt_message _("Alias added.");
}
else
mutt_perror (buf);
fseeko ((s.fpin = fp), m->offset, 0);
mutt_decode_attachment (m, &s);
- if (fclose (s.fpout) != 0)
+ if (safe_fsync_close (&s.fpout) != 0)
{
mutt_perror ("fclose");
mutt_sleep (2);
return (-1);
}
safe_fclose (&ofp);
- safe_fclose (&nfp);
+ if (safe_fsync_close (&nfp) != 0) {
+ mutt_error _("Write fault!");
+ return (-1);
+ }
}
return 0;
unsigned int saved_encoding = 0;
BODY *saved_parts = NULL;
HEADER *saved_hdr = NULL;
+ int ret = 0;
memset (&s, 0, sizeof (s));
s.flags = displaying;
mutt_body_handler (m, &s);
- safe_fclose (&s.fpout);
+ if (safe_fsync_close (&s.fpout) != 0) {
+ mutt_perror("fclose");
+ ret = -1;
+ }
if (fp == NULL)
{
m->length = 0;
safe_fclose (&s.fpin);
}
- return (0);
+ return ret;
}
/* Ok, the difference between send and receive:
{
if (fflush (*f) || fsync (fileno (*f)))
{
+ int save_errno = errno;
r = -1;
safe_fclose (f);
+ errno = save_errno;
}
else
r = safe_fclose (f);
size -= chunk;
}
+ if (fflush(out) != 0) return -1;
return 0;
}
return (-1);
}
+ if (fflush(fout) != 0) return -1;
return 0;
}
mutt_copy_header (fp, h, f, ch_flags, NULL);
fputc ('\n', f);
mutt_copy_bytes (fp, f, h->content->length);
- safe_fclose (&f);
FREE (&msgid_str);
-
+ if (safe_fclose (&f) != 0) {
+ mutt_perror(tempfile);
+ unlink(tempfile);
+ return -1;
+ }
#if USE_SMTP
if (SmtpUrl)
ret = mutt_smtp_send (env_from, to, NULL, NULL, tempfile,