diff options
| author | Eli Zaretskii | 2013-12-25 19:30:24 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2013-12-25 19:30:24 +0200 |
| commit | 9ab3ce4d2f1c6409d36072192bfce797ec189837 (patch) | |
| tree | f4de06d08f0705af82b9bf0e50d6973b92fe63ef /src | |
| parent | fec0e8283f7ce156c6fa1aa86a36a84ada54965b (diff) | |
| download | emacs-9ab3ce4d2f1c6409d36072192bfce797ec189837.tar.gz emacs-9ab3ce4d2f1c6409d36072192bfce797ec189837.zip | |
Fix bug #16252 with 'mailto:' documents passed to w32-shell-execute.
src/w32fns.c (Fw32_shell_execute): Make DOCUMENT absolute only if it
is a file name.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 5 | ||||
| -rw-r--r-- | src/w32fns.c | 15 |
2 files changed, 18 insertions, 2 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index a883182754d..1e8684c4ddb 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2013-12-25 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * w32fns.c (Fw32_shell_execute): Make DOCUMENT absolute only if it | ||
| 4 | is a file name. (Bug#16252) | ||
| 5 | |||
| 1 | 2013-12-25 Chong Yidong <cyd@gnu.org> | 6 | 2013-12-25 Chong Yidong <cyd@gnu.org> |
| 2 | 7 | ||
| 3 | * keyboard.c (Voverriding_terminal_local_map): | 8 | * keyboard.c (Voverriding_terminal_local_map): |
diff --git a/src/w32fns.c b/src/w32fns.c index c1621acf513..02850d8954d 100644 --- a/src/w32fns.c +++ b/src/w32fns.c | |||
| @@ -6851,7 +6851,8 @@ operations: | |||
| 6851 | 6851 | ||
| 6852 | DOCUMENT is typically the name of a document file or a URL, but can | 6852 | DOCUMENT is typically the name of a document file or a URL, but can |
| 6853 | also be a program executable to run, or a directory to open in the | 6853 | also be a program executable to run, or a directory to open in the |
| 6854 | Windows Explorer. | 6854 | Windows Explorer. If it is a file, it must be a local one; this |
| 6855 | function does not support remote file names. | ||
| 6855 | 6856 | ||
| 6856 | If DOCUMENT is a program executable, the optional third arg PARAMETERS | 6857 | If DOCUMENT is a program executable, the optional third arg PARAMETERS |
| 6857 | can be a string containing command line parameters that will be passed | 6858 | can be a string containing command line parameters that will be passed |
| @@ -6875,6 +6876,7 @@ an integer representing a ShowWindow flag: | |||
| 6875 | #ifndef CYGWIN | 6876 | #ifndef CYGWIN |
| 6876 | int use_unicode = w32_unicode_filenames; | 6877 | int use_unicode = w32_unicode_filenames; |
| 6877 | char *doc_a = NULL, *params_a = NULL, *ops_a = NULL; | 6878 | char *doc_a = NULL, *params_a = NULL, *ops_a = NULL; |
| 6879 | Lisp_Object absdoc; | ||
| 6878 | #endif | 6880 | #endif |
| 6879 | 6881 | ||
| 6880 | CHECK_STRING (document); | 6882 | CHECK_STRING (document); |
| @@ -6903,7 +6905,16 @@ an integer representing a ShowWindow flag: | |||
| 6903 | ? XINT (show_flag) : SW_SHOWDEFAULT)); | 6905 | ? XINT (show_flag) : SW_SHOWDEFAULT)); |
| 6904 | #else /* !CYGWIN */ | 6906 | #else /* !CYGWIN */ |
| 6905 | current_dir = ENCODE_FILE (current_dir); | 6907 | current_dir = ENCODE_FILE (current_dir); |
| 6906 | document = ENCODE_FILE (Fexpand_file_name (document, Qnil)); | 6908 | /* We have a situation here. If DOCUMENT is a relative file name, |
| 6909 | and is not in CURRENT_DIR, ShellExecute below will fail to find | ||
| 6910 | it. So we need to make the file name absolute. But DOCUMENT | ||
| 6911 | does not have to be a file, it can be a URL, for example. So we | ||
| 6912 | make it absolute only if it is an existing file; if it is a file | ||
| 6913 | that does not exist, tough. */ | ||
| 6914 | absdoc = Fexpand_file_name (document, Qnil); | ||
| 6915 | if (!NILP (Ffile_exists_p (absdoc))) | ||
| 6916 | document = absdoc; | ||
| 6917 | document = ENCODE_FILE (document); | ||
| 6907 | if (use_unicode) | 6918 | if (use_unicode) |
| 6908 | { | 6919 | { |
| 6909 | wchar_t document_w[MAX_PATH], current_dir_w[MAX_PATH]; | 6920 | wchar_t document_w[MAX_PATH], current_dir_w[MAX_PATH]; |