diff options
| author | Kenichi Handa | 1997-11-08 03:05:44 +0000 |
|---|---|---|
| committer | Kenichi Handa | 1997-11-08 03:05:44 +0000 |
| commit | c364e618664b9102b7a9e6f49da3abe0c3cb1459 (patch) | |
| tree | f64c2ba8f7f41c969b3773b00c7869e30f577c25 /src | |
| parent | f1c54f1aed01aa8a6247be58f8a21e0d92aa714e (diff) | |
| download | emacs-c364e618664b9102b7a9e6f49da3abe0c3cb1459.tar.gz emacs-c364e618664b9102b7a9e6f49da3abe0c3cb1459.zip | |
(Fcall_process): GCPRO infile, buffer, and
current_dir before encoding arguments.
Diffstat (limited to 'src')
| -rw-r--r-- | src/callproc.c | 61 |
1 files changed, 36 insertions, 25 deletions
diff --git a/src/callproc.c b/src/callproc.c index 1be4b4b2a12..685efd66642 100644 --- a/src/callproc.c +++ b/src/callproc.c | |||
| @@ -418,31 +418,42 @@ If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.") | |||
| 418 | report_file_error ("Searching for program", Fcons (args[0], Qnil)); | 418 | report_file_error ("Searching for program", Fcons (args[0], Qnil)); |
| 419 | } | 419 | } |
| 420 | new_argv[0] = XSTRING (path)->data; | 420 | new_argv[0] = XSTRING (path)->data; |
| 421 | { | 421 | if (nargs > 4) |
| 422 | register int i; | 422 | { |
| 423 | for (i = 4; i < nargs; i++) | 423 | register int i; |
| 424 | { | 424 | |
| 425 | CHECK_STRING (args[i], i); | 425 | for (i = 4; i < nargs; i++) CHECK_STRING (args[i], i); |
| 426 | if (argument_coding.type == coding_type_no_conversion) | 426 | |
| 427 | new_argv[i - 3] = XSTRING (args[i])->data; | 427 | if (! CODING_REQUIRE_ENCODING (&argument_coding)) |
| 428 | else | 428 | { |
| 429 | { | 429 | for (i = 4; i < nargs; i++) |
| 430 | /* We must encode the arguments. */ | 430 | new_argv[i - 3] = XSTRING (args[i])->data; |
| 431 | int size = encoding_buffer_size (&argument_coding, | 431 | } |
| 432 | XSTRING (args[i])->size); | 432 | else |
| 433 | int produced, dummy; | 433 | { |
| 434 | unsigned char *dummy1 = (unsigned char *) alloca (size); | 434 | /* We must encode the arguments. */ |
| 435 | 435 | struct gcpro gcpro1, gcpro2, gcpro3; | |
| 436 | /* The Irix 4.0 compiler barfs if we eliminate dummy. */ | 436 | |
| 437 | new_argv[i - 3] = dummy1; | 437 | GCPRO3 (infile, buffer, current_dir); |
| 438 | produced = encode_coding (&argument_coding, | 438 | for (i = 4; i < nargs; i++) |
| 439 | XSTRING (args[i])->data, new_argv[i - 3], | 439 | { |
| 440 | XSTRING (args[i])->size, size, &dummy); | 440 | int size = encoding_buffer_size (&argument_coding, |
| 441 | new_argv[i - 3][produced] = 0; | 441 | XSTRING (args[i])->size); |
| 442 | } | 442 | unsigned char *dummy1 = (unsigned char *) alloca (size); |
| 443 | } | 443 | int produced, dummy; |
| 444 | new_argv[i - 3] = 0; | 444 | |
| 445 | } | 445 | /* The Irix 4.0 compiler barfs if we eliminate dummy. */ |
| 446 | new_argv[i - 3] = dummy1; | ||
| 447 | produced = encode_coding (&argument_coding, | ||
| 448 | XSTRING (args[i])->data, | ||
| 449 | new_argv[i - 3], | ||
| 450 | XSTRING (args[i])->size, size, &dummy); | ||
| 451 | new_argv[i - 3][produced] = 0; | ||
| 452 | } | ||
| 453 | UNGCPRO; | ||
| 454 | } | ||
| 455 | } | ||
| 456 | new_argv[nargs - 3] = 0; | ||
| 446 | 457 | ||
| 447 | #ifdef MSDOS /* MW, July 1993 */ | 458 | #ifdef MSDOS /* MW, July 1993 */ |
| 448 | if ((outf = egetenv ("TMP")) || (outf = egetenv ("TEMP"))) | 459 | if ((outf = egetenv ("TMP")) || (outf = egetenv ("TEMP"))) |