X-Git-Url: http://git.madism.org/?a=blobdiff_plain;f=lib-lib%2Ffile.c;h=56bcf1fcebb14f9ec809b8eb3baa26304e973262;hb=3766db5f849cea008b1cd3d532c712aeb17aa062;hp=978895af0734b9c6f356b1d13ca3c12b6b40f1c0;hpb=fcaada9d60ee8f52bbc8503c06fe061ca9e2fa68;p=apps%2Fmadmutt.git diff --git a/lib-lib/file.c b/lib-lib/file.c index 978895a..56bcf1f 100644 --- a/lib-lib/file.c +++ b/lib-lib/file.c @@ -232,16 +232,6 @@ FILE *safe_fopen(const char *path, const char *mode) return fopen(path, mode); } -int safe_fclose(FILE **f) -{ - int r = 0; - - if (*f) - r = fclose (*f); - *f = NULL; - return r; -} - /* If rfc1524_expand_command() is used on a recv'd message, then * the filename doesn't exist yet, but if its used while sending a message, * then we need to rename the existing file. @@ -506,7 +496,7 @@ int m_tempfd(char *dst, ssize_t n, const char *dir, const char *fmt) m_tempftplize(tpl, sizeof(tpl), fmt, raw); } - fd = open(path, O_CREAT | O_EXCL | O_WRONLY | O_NOFOLLOW, 0600); + fd = open(path, O_CREAT | O_EXCL | O_RDWR | O_NOFOLLOW, 0600); if (fd < 0) { if (errno == EEXIST)