aboutsummaryrefslogtreecommitdiffstats
path: root/src/callproc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/callproc.c')
-rw-r--r--src/callproc.c23
1 files changed, 8 insertions, 15 deletions
diff --git a/src/callproc.c b/src/callproc.c
index 0fdf278073d..63ab9bf70db 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -131,12 +131,9 @@ encode_current_directory (void)
131 report_file_error ("Setting current directory", 131 report_file_error ("Setting current directory",
132 BVAR (current_buffer, directory)); 132 BVAR (current_buffer, directory));
133 133
134 /* Remove "/:" from dir. */ 134 /* Remove "/:" from DIR and encode it. */
135 if (! NILP (Fstring_match (build_string ("^/:"), dir, Qnil))) 135 dir = ENCODE_FILE (remove_slash_colon (dir));
136 dir = Fsubstring (dir, make_number (2), Qnil);
137 136
138 if (STRING_MULTIBYTE (dir))
139 dir = ENCODE_FILE (dir);
140 if (! file_accessible_directory_p (dir)) 137 if (! file_accessible_directory_p (dir))
141 report_file_error ("Setting current directory", 138 report_file_error ("Setting current directory",
142 BVAR (current_buffer, directory)); 139 BVAR (current_buffer, directory));
@@ -267,7 +264,7 @@ usage: (call-process PROGRAM &optional INFILE DESTINATION DISPLAY &rest ARGS) *
267 infile = build_string (NULL_DEVICE); 264 infile = build_string (NULL_DEVICE);
268 265
269 GCPRO1 (infile); 266 GCPRO1 (infile);
270 encoded_infile = STRING_MULTIBYTE (infile) ? ENCODE_FILE (infile) : infile; 267 encoded_infile = ENCODE_FILE (infile);
271 268
272 filefd = emacs_open (SSDATA (encoded_infile), O_RDONLY, 0); 269 filefd = emacs_open (SSDATA (encoded_infile), O_RDONLY, 0);
273 if (filefd < 0) 270 if (filefd < 0)
@@ -439,9 +436,9 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int filefd,
439 436
440 GCPRO4 (buffer, current_dir, error_file, output_file); 437 GCPRO4 (buffer, current_dir, error_file, output_file);
441 438
442 if (STRINGP (error_file) && STRING_MULTIBYTE (error_file)) 439 if (STRINGP (error_file))
443 error_file = ENCODE_FILE (error_file); 440 error_file = ENCODE_FILE (error_file);
444 if (STRINGP (output_file) && STRING_MULTIBYTE (output_file)) 441 if (STRINGP (output_file))
445 output_file = ENCODE_FILE (output_file); 442 output_file = ENCODE_FILE (output_file);
446 UNGCPRO; 443 UNGCPRO;
447 } 444 }
@@ -468,11 +465,8 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int filefd,
468 report_file_error ("Searching for program", args[0]); 465 report_file_error ("Searching for program", args[0]);
469 } 466 }
470 467
471 /* If program file name starts with /: for quoting a magic name, 468 /* Remove "/:" from PATH. */
472 discard that. */ 469 path = remove_slash_colon (path);
473 if (SBYTES (path) > 2 && SREF (path, 0) == '/'
474 && SREF (path, 1) == ':')
475 path = Fsubstring (path, make_number (2), Qnil);
476 470
477 SAFE_NALLOCA (new_argv, 1, nargs < 4 ? 2 : nargs - 2); 471 SAFE_NALLOCA (new_argv, 1, nargs < 4 ? 2 : nargs - 2);
478 472
@@ -498,8 +492,7 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int filefd,
498 } 492 }
499 else 493 else
500 new_argv[1] = 0; 494 new_argv[1] = 0;
501 if (STRING_MULTIBYTE (path)) 495 path = ENCODE_FILE (path);
502 path = ENCODE_FILE (path);
503 new_argv[0] = SSDATA (path); 496 new_argv[0] = SSDATA (path);
504 UNGCPRO; 497 UNGCPRO;
505 } 498 }