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
This commit is contained in:
parent
158bc55c6e
commit
f4b169ce67
2 changed files with 9 additions and 2 deletions
|
@ -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>
|
2013-07-30 Dmitry Antipov <dmantipov@yandex.ru>
|
||||||
|
|
||||||
* xfaces.c (make_face_cache): For struct face_cache, prefer
|
* xfaces.c (make_face_cache): For struct face_cache, prefer
|
||||||
|
|
|
@ -1018,13 +1018,14 @@ create_temp_file (ptrdiff_t nargs, Lisp_Object *args)
|
||||||
#else
|
#else
|
||||||
errno = EEXIST;
|
errno = EEXIST;
|
||||||
mktemp (tempfile);
|
mktemp (tempfile);
|
||||||
/* INT_MAX denotes success, because close (INT_MAX) does nothing. */
|
fd = *tempfile ? 0 : -1;
|
||||||
fd = *tempfile ? INT_MAX : -1;
|
|
||||||
#endif
|
#endif
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
report_file_error ("Failed to open temporary file using pattern",
|
report_file_error ("Failed to open temporary file using pattern",
|
||||||
pattern);
|
pattern);
|
||||||
|
#if defined HAVE_MKOSTEMP || defined HAVE_MKSTEMP
|
||||||
emacs_close (fd);
|
emacs_close (fd);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
record_unwind_protect (delete_temp_file, filename_string);
|
record_unwind_protect (delete_temp_file, filename_string);
|
||||||
|
|
Loading…
Add table
Reference in a new issue