diff options
| author | Glenn Morris | 2012-12-05 22:17:10 -0800 |
|---|---|---|
| committer | Glenn Morris | 2012-12-05 22:17:10 -0800 |
| commit | d8ad4d3ff9dcea9c581d72e1e9ec292ea18673b1 (patch) | |
| tree | 511f16e150fca1ed64ec71800eb0e62a9d95578a /src | |
| parent | b7f3003fdd2e6baacddcd7657708e887a6580785 (diff) | |
| parent | e1d51545ced3cf6f58c44891563dfaf62c34b411 (diff) | |
| download | emacs-d8ad4d3ff9dcea9c581d72e1e9ec292ea18673b1.tar.gz emacs-d8ad4d3ff9dcea9c581d72e1e9ec292ea18673b1.zip | |
Merge from emacs-24; up to 2012-11-24T16:58:43Z!cyd@gnu.org
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 13 | ||||
| -rw-r--r-- | src/callproc.c | 13 | ||||
| -rw-r--r-- | src/fileio.c | 22 |
3 files changed, 42 insertions, 6 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index a6ba03a0069..795582c802b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,16 @@ | |||
| 1 | 2012-12-06 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * callproc.c (Fcall_process_region) [!HAVE_MKSTEMP]: If mktemp | ||
| 4 | fails, signal an error instead of continuing with an empty | ||
| 5 | string. (Bug#13079) | ||
| 6 | Encode expanded temp file pattern before passing it to mkstemp or | ||
| 7 | mktemp. | ||
| 8 | |||
| 9 | * fileio.c (file_name_as_directory, directory_file_name) [DOS_NT]: | ||
| 10 | Encode the file name before passing it to dostounix_filename, in | ||
| 11 | case it will downcase it (under w32-downcase-file-names). | ||
| 12 | (Bug#12933) | ||
| 13 | |||
| 1 | 2012-12-05 Paul Eggert <eggert@cs.ucla.edu> | 14 | 2012-12-05 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 15 | ||
| 3 | Minor call-process cleanups. | 16 | Minor call-process cleanups. |
diff --git a/src/callproc.c b/src/callproc.c index 2c3d31ba052..6153bc1b6c6 100644 --- a/src/callproc.c +++ b/src/callproc.c | |||
| @@ -977,8 +977,9 @@ usage: (call-process-region START END PROGRAM &optional DELETE BUFFER DISPLAY &r | |||
| 977 | { | 977 | { |
| 978 | USE_SAFE_ALLOCA; | 978 | USE_SAFE_ALLOCA; |
| 979 | Lisp_Object pattern = Fexpand_file_name (Vtemp_file_name_pattern, tmpdir); | 979 | Lisp_Object pattern = Fexpand_file_name (Vtemp_file_name_pattern, tmpdir); |
| 980 | char *tempfile = SAFE_ALLOCA (SBYTES (pattern) + 1); | 980 | Lisp_Object encoded_tem = ENCODE_FILE (pattern); |
| 981 | memcpy (tempfile, SDATA (pattern), SBYTES (pattern) + 1); | 981 | char *tempfile = SAFE_ALLOCA (SBYTES (encoded_tem) + 1); |
| 982 | memcpy (tempfile, SDATA (encoded_tem), SBYTES (encoded_tem) + 1); | ||
| 982 | coding_systems = Qt; | 983 | coding_systems = Qt; |
| 983 | 984 | ||
| 984 | #ifdef HAVE_MKSTEMP | 985 | #ifdef HAVE_MKSTEMP |
| @@ -995,7 +996,15 @@ usage: (call-process-region START END PROGRAM &optional DELETE BUFFER DISPLAY &r | |||
| 995 | close (fd); | 996 | close (fd); |
| 996 | } | 997 | } |
| 997 | #else | 998 | #else |
| 999 | errno = 0; | ||
| 998 | mktemp (tempfile); | 1000 | mktemp (tempfile); |
| 1001 | if (!*tempfile) | ||
| 1002 | { | ||
| 1003 | if (!errno) | ||
| 1004 | errno = EEXIST; | ||
| 1005 | report_file_error ("Failed to open temporary file using pattern", | ||
| 1006 | Fcons (pattern, Qnil)); | ||
| 1007 | } | ||
| 999 | #endif | 1008 | #endif |
| 1000 | 1009 | ||
| 1001 | filename_string = build_string (tempfile); | 1010 | filename_string = build_string (tempfile); |
diff --git a/src/fileio.c b/src/fileio.c index 9edd88ca64f..de3b84ba95d 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -455,7 +455,7 @@ get a current directory to run processes in. */) | |||
| 455 | 455 | ||
| 456 | /* Convert from file name SRC of length SRCLEN to directory name | 456 | /* Convert from file name SRC of length SRCLEN to directory name |
| 457 | in DST. On UNIX, just make sure there is a terminating /. | 457 | in DST. On UNIX, just make sure there is a terminating /. |
| 458 | Return the length of DST. */ | 458 | Return the length of DST in bytes. */ |
| 459 | 459 | ||
| 460 | static ptrdiff_t | 460 | static ptrdiff_t |
| 461 | file_name_as_directory (char *dst, const char *src, ptrdiff_t srclen) | 461 | file_name_as_directory (char *dst, const char *src, ptrdiff_t srclen) |
| @@ -477,7 +477,14 @@ file_name_as_directory (char *dst, const char *src, ptrdiff_t srclen) | |||
| 477 | srclen++; | 477 | srclen++; |
| 478 | } | 478 | } |
| 479 | #ifdef DOS_NT | 479 | #ifdef DOS_NT |
| 480 | dostounix_filename (dst); | 480 | { |
| 481 | Lisp_Object tem_fn = make_specified_string (dst, -1, srclen, 1); | ||
| 482 | |||
| 483 | tem_fn = ENCODE_FILE (tem_fn); | ||
| 484 | dostounix_filename (SSDATA (tem_fn)); | ||
| 485 | tem_fn = DECODE_FILE (tem_fn); | ||
| 486 | memcpy (dst, SSDATA (tem_fn), (srclen = SBYTES (tem_fn)) + 1); | ||
| 487 | } | ||
| 481 | #endif | 488 | #endif |
| 482 | return srclen; | 489 | return srclen; |
| 483 | } | 490 | } |
| @@ -519,7 +526,7 @@ For a Unix-syntax file name, just appends a slash. */) | |||
| 519 | 526 | ||
| 520 | /* Convert from directory name SRC of length SRCLEN to | 527 | /* Convert from directory name SRC of length SRCLEN to |
| 521 | file name in DST. On UNIX, just make sure there isn't | 528 | file name in DST. On UNIX, just make sure there isn't |
| 522 | a terminating /. Return the length of DST. */ | 529 | a terminating /. Return the length of DST in bytes. */ |
| 523 | 530 | ||
| 524 | static ptrdiff_t | 531 | static ptrdiff_t |
| 525 | directory_file_name (char *dst, char *src, ptrdiff_t srclen) | 532 | directory_file_name (char *dst, char *src, ptrdiff_t srclen) |
| @@ -538,7 +545,14 @@ directory_file_name (char *dst, char *src, ptrdiff_t srclen) | |||
| 538 | srclen--; | 545 | srclen--; |
| 539 | } | 546 | } |
| 540 | #ifdef DOS_NT | 547 | #ifdef DOS_NT |
| 541 | dostounix_filename (dst); | 548 | { |
| 549 | Lisp_Object tem_fn = make_specified_string (dst, -1, srclen, 1); | ||
| 550 | |||
| 551 | tem_fn = ENCODE_FILE (tem_fn); | ||
| 552 | dostounix_filename (SSDATA (tem_fn)); | ||
| 553 | tem_fn = DECODE_FILE (tem_fn); | ||
| 554 | memcpy (dst, SSDATA (tem_fn), (srclen = SBYTES (tem_fn)) + 1); | ||
| 555 | } | ||
| 542 | #endif | 556 | #endif |
| 543 | return srclen; | 557 | return srclen; |
| 544 | } | 558 | } |