diff options
| author | Paul Eggert | 2013-07-16 15:40:17 -0700 |
|---|---|---|
| committer | Paul Eggert | 2013-07-16 15:40:17 -0700 |
| commit | 50a30ccec8932037b7f56122d723037cf8993147 (patch) | |
| tree | 4e4cf897070ea0814fc95a7f46c4d63e919522eb /src | |
| parent | 41d48a42df6ce4e5af9543f97313e256f16aa900 (diff) | |
| download | emacs-50a30ccec8932037b7f56122d723037cf8993147.tar.gz emacs-50a30ccec8932037b7f56122d723037cf8993147.zip | |
Fix w32 bug with call-process-region.
* callproc.c (Fcall_process_region): Pass nil, not "/dev/null",
to Fcall_process when the input is empty. This simplifies the
code a bit. It makes no difference on POSIXish platforms but
apparently it fixes a bug on w32.
Fixes: debbugs:14885
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 8 | ||||
| -rw-r--r-- | src/callproc.c | 10 |
2 files changed, 11 insertions, 7 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index ab90682aa67..a70058ac690 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,6 +1,12 @@ | |||
| 1 | 2013-07-16 Paul Eggert <eggert@cs.ucla.edu> | 1 | 2013-07-16 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 2 | ||
| 3 | Fix bug where Emacs tries to close a file twice (Bug#14839). | 3 | Fix w32 bug with call-process-region (Bug#14885). |
| 4 | * callproc.c (Fcall_process_region): Pass nil, not "/dev/null", | ||
| 5 | to Fcall_process when the input is empty. This simplifies the | ||
| 6 | code a bit. It makes no difference on POSIXish platforms but | ||
| 7 | apparently it fixes a bug on w32. | ||
| 8 | |||
| 9 | Fix bug where insert-file-contents closes a file twice. (Bug#14839). | ||
| 4 | * fileio.c (close_file_unwind): Don't close if FD is negative; | 10 | * fileio.c (close_file_unwind): Don't close if FD is negative; |
| 5 | this can happen when unwinding a zapped file descriptor. | 11 | this can happen when unwinding a zapped file descriptor. |
| 6 | (Finsert_file_contents): Unwind-protect the fd before the point marker, | 12 | (Finsert_file_contents): Unwind-protect the fd before the point marker, |
diff --git a/src/callproc.c b/src/callproc.c index f2c8c0c6223..85ebf449e43 100644 --- a/src/callproc.c +++ b/src/callproc.c | |||
| @@ -1093,7 +1093,7 @@ usage: (call-process-region START END PROGRAM &optional DELETE BUFFER DISPLAY &r | |||
| 1093 | (ptrdiff_t nargs, Lisp_Object *args) | 1093 | (ptrdiff_t nargs, Lisp_Object *args) |
| 1094 | { | 1094 | { |
| 1095 | struct gcpro gcpro1; | 1095 | struct gcpro gcpro1; |
| 1096 | Lisp_Object filename_string; | 1096 | Lisp_Object infile; |
| 1097 | ptrdiff_t count = SPECPDL_INDEX (); | 1097 | ptrdiff_t count = SPECPDL_INDEX (); |
| 1098 | Lisp_Object start = args[0]; | 1098 | Lisp_Object start = args[0]; |
| 1099 | Lisp_Object end = args[1]; | 1099 | Lisp_Object end = args[1]; |
| @@ -1111,10 +1111,8 @@ usage: (call-process-region START END PROGRAM &optional DELETE BUFFER DISPLAY &r | |||
| 1111 | empty_input = XINT (start) == XINT (end); | 1111 | empty_input = XINT (start) == XINT (end); |
| 1112 | } | 1112 | } |
| 1113 | 1113 | ||
| 1114 | filename_string = (empty_input | 1114 | infile = empty_input ? Qnil : create_temp_file (nargs, args); |
| 1115 | ? build_string (NULL_DEVICE) | 1115 | GCPRO1 (infile); |
| 1116 | : create_temp_file (nargs, args)); | ||
| 1117 | GCPRO1 (filename_string); | ||
| 1118 | 1116 | ||
| 1119 | if (nargs > 3 && !NILP (args[3])) | 1117 | if (nargs > 3 && !NILP (args[3])) |
| 1120 | Fdelete_region (start, end); | 1118 | Fdelete_region (start, end); |
| @@ -1129,7 +1127,7 @@ usage: (call-process-region START END PROGRAM &optional DELETE BUFFER DISPLAY &r | |||
| 1129 | args[0] = args[2]; | 1127 | args[0] = args[2]; |
| 1130 | nargs = 2; | 1128 | nargs = 2; |
| 1131 | } | 1129 | } |
| 1132 | args[1] = filename_string; | 1130 | args[1] = infile; |
| 1133 | 1131 | ||
| 1134 | RETURN_UNGCPRO (unbind_to (count, Fcall_process (nargs, args))); | 1132 | RETURN_UNGCPRO (unbind_to (count, Fcall_process (nargs, args))); |
| 1135 | } | 1133 | } |