diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2013-07-30 23:44:43 +0200 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2013-07-30 23:44:43 +0200 |
commit | f4b169ce6767c017de7cc7aaa07652b6a71e361f (patch) | |
tree | 7ac89c2be0f9f7357e0234e8e56e56924198a277 | |
parent | 158bc55c6e715be476acacbef2aa8ca9b50c94c6 (diff) | |
download | emacs-f4b169ce6767c017de7cc7aaa07652b6a71e361f.tar.gz |
Fix tempfile bug on platforms lacking mkostemp and mkstemp.
* callproc.c (create_temp_file) [! (HAVE_MKOSTEMP || HAVE_MKSTEMP)]:
Do not assume that emacs_close (INT_MAX) is a no-op.
Fixes: debbugs:14986
-rw-r--r-- | src/ChangeLog | 6 | ||||
-rw-r--r-- | src/callproc.c | 5 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index bfe4dfaf39a..fd54607049e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2013-07-30 Paul Eggert <eggert@cs.ucla.edu> + + Fix tempfile bug on platforms lacking mkostemp and mkstemp (Bug#14986). + * callproc.c (create_temp_file) [! (HAVE_MKOSTEMP || HAVE_MKSTEMP)]: + Do not assume that emacs_close (INT_MAX) is a no-op. + 2013-07-30 Dmitry Antipov <dmantipov@yandex.ru> * xfaces.c (make_face_cache): For struct face_cache, prefer diff --git a/src/callproc.c b/src/callproc.c index 91f29bd589b..450fc57f929 100644 --- a/src/callproc.c +++ b/src/callproc.c @@ -1018,13 +1018,14 @@ create_temp_file (ptrdiff_t nargs, Lisp_Object *args) #else errno = EEXIST; mktemp (tempfile); - /* INT_MAX denotes success, because close (INT_MAX) does nothing. */ - fd = *tempfile ? INT_MAX : -1; + fd = *tempfile ? 0 : -1; #endif if (fd < 0) report_file_error ("Failed to open temporary file using pattern", pattern); +#if defined HAVE_MKOSTEMP || defined HAVE_MKSTEMP emacs_close (fd); +#endif } record_unwind_protect (delete_temp_file, filename_string); |