* callproc.c (Fcall_process_region): Fix minor race and tune.
commitbafe80ce49206c61bea74b0c70080bfdc97785d1
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 15 Jul 2013 02:56:17 +0000 (14 19:56 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 15 Jul 2013 02:56:17 +0000 (14 19:56 -0700)
tree22253f5fabd4df1513fe28e403280cf5d4e98e28
parent0463c1ef26bf2d3dc3ea8a3de20e4446c1a55e64
* callproc.c (Fcall_process_region): Fix minor race and tune.

(create_temp_file): New function, with the temp-file-creation part
of the old Fcall_process_region.  Use Fcopy_sequence to create the
temp file name, rather than alloca + build_string, for simplicity.
Don't bother to block input around the temp file creation;
shouldn't be needed.  Simplify use of mktemp.  Use
record_unwind_protect immediately after creating the temp file;
this closes an unlikely race where the temp file was not removed.
Use memcpy rather than an open-coded loop.
(Fcall_process_region): Use the new function.  If the input is
empty, redirect from /dev/null rather than from a newly created
empty temp file; this avoids unnecessary file system traffic.
src/ChangeLog
src/callproc.c