aboutsummaryrefslogtreecommitdiffstats
path: root/src/callproc.c
diff options
context:
space:
mode:
authorPaul Eggert2013-07-30 23:44:43 +0200
committerPaul Eggert2013-07-30 23:44:43 +0200
commitf4b169ce6767c017de7cc7aaa07652b6a71e361f (patch)
tree7ac89c2be0f9f7357e0234e8e56e56924198a277 /src/callproc.c
parent158bc55c6e715be476acacbef2aa8ca9b50c94c6 (diff)
downloademacs-f4b169ce6767c017de7cc7aaa07652b6a71e361f.tar.gz
emacs-f4b169ce6767c017de7cc7aaa07652b6a71e361f.zip
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
Diffstat (limited to 'src/callproc.c')
-rw-r--r--src/callproc.c5
1 files changed, 3 insertions, 2 deletions
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)
1018#else 1018#else
1019 errno = EEXIST; 1019 errno = EEXIST;
1020 mktemp (tempfile); 1020 mktemp (tempfile);
1021 /* INT_MAX denotes success, because close (INT_MAX) does nothing. */ 1021 fd = *tempfile ? 0 : -1;
1022 fd = *tempfile ? INT_MAX : -1;
1023#endif 1022#endif
1024 if (fd < 0) 1023 if (fd < 0)
1025 report_file_error ("Failed to open temporary file using pattern", 1024 report_file_error ("Failed to open temporary file using pattern",
1026 pattern); 1025 pattern);
1026#if defined HAVE_MKOSTEMP || defined HAVE_MKSTEMP
1027 emacs_close (fd); 1027 emacs_close (fd);
1028#endif
1028 } 1029 }
1029 1030
1030 record_unwind_protect (delete_temp_file, filename_string); 1031 record_unwind_protect (delete_temp_file, filename_string);