[PATCH] HAVE_MKSTEMP tries to kill not existent tmp-file in $HOME and $TMPDIR (1.9.2)
Rado S <[email protected]>
| Newsgroups | gmane.network.tin.devel |
|---|---|
| Message-ID | <[email protected]> |
Moin, after revisiting this issue, I offer this attached patch: even though this 5s delay for each successful posting is very annoying, the debug output is totally useless, when you read "man mkstemp", because it says: ------ QUOTE BEGIN ------ The function thus prevents any possible race condition between testing whether the file exists and opening it for use. ------- QUOTE END ------- Therefore by defintion there any ENOENT case is just a side-effect: the idea of this function is to not have the tmp-file exist. Also, when things go wrong, a user should be informed about the reason, even when not in DEBUG mode, no? -- © Rado S. -- You must provide YOUR effort for your goal! EVERY effort counts: at least to show your attitude. You're responsible for ALL you do: you get what you give.
quiet.pat
(text/plain, 699 B)
--- torg/src/my_tmpfile.c Tue Mar 27 20:25:48 2007 +++ tgo/src/my_tmpfile.c Thu May 24 18:22:26 2007 @@ -88,17 +88,11 @@ } #ifdef HAVE_MKSTEMP fd = mkstemp(filename); -# ifdef DEBUG - if (errno) - wait_message(5, "HAVE_MKSTEMP %s: %s", filename, strerror(errno)); -# endif /* DEBUG */ #else # ifdef HAVE_MKTEMP fd = open(mktemp(filename), (O_WRONLY|O_CREAT|O_EXCL), (mode_t) (S_IRUSR|S_IWUSR)); -# ifdef DEBUG - if (errno) - wait_message(5, "HAVE_MKTEMP %s: %s", filename, strerror(errno)); -# endif /* DEBUG */ + if (errno && (errno != ENOENT)) + wait_message(5, "HAVE_MK(S)TEMP %s: %s", filename, strerror(errno)); # endif /* HAVE_MKTEMP */ #endif /* HAVE_MKSTEMP */ }