From c8670ded9c8c4fe3801b6a378ee93f9180ce0453 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Tue, 11 May 2010 20:23:52 +0300 Subject: [PATCH] Backport from trunk: Fix bug #6126. makefile.w32-in ($(BLD)/w32fns.$(O)): Depend on $(SRC)/w32.h. w32fns.c: Include w32.h. (Fw32_shell_execute): Decode the error message before passing it to `error'. --- src/ChangeLog | 8 ++++++++ src/makefile.w32-in | 1 + src/w32fns.c | 14 +++++++++++++- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/ChangeLog b/src/ChangeLog index 4e0c7e6df71..8e2774f2a03 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2010-05-11 Eli Zaretskii + + * makefile.w32-in ($(BLD)/w32fns.$(O)): Depend on $(SRC)/w32.h. + + * w32fns.c: Include w32.h. + (Fw32_shell_execute): Decode the error message before passing it + to `error'. (Bug#6126) + 2010-05-11 Karel Klic * ftfont.c: Fix incorrect parentheses of #if condition for diff --git a/src/makefile.w32-in b/src/makefile.w32-in index 156eddd6092..591e38fb60d 100644 --- a/src/makefile.w32-in +++ b/src/makefile.w32-in @@ -1564,6 +1564,7 @@ $(BLD)/w32fns.$(O) : \ $(SRC)/keyboard.h \ $(SRC)/systime.h \ $(SRC)/termhooks.h \ + $(SRC)/w32.h \ $(SRC)/w32font.h \ $(SRC)/w32gui.h \ $(SRC)/w32heap.h \ diff --git a/src/w32fns.c b/src/w32fns.c index 795e7208569..bc310da0d2f 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -47,6 +47,7 @@ along with GNU Emacs. If not, see . */ #include "systime.h" #include "termhooks.h" #include "w32heap.h" +#include "w32.h" #include "bitmaps/gray.xbm" @@ -6333,6 +6334,7 @@ an integer representing a ShowWindow flag: Lisp_Object operation, document, parameters, show_flag; { Lisp_Object current_dir; + char *errstr; CHECK_STRING (document); @@ -6353,7 +6355,17 @@ an integer representing a ShowWindow flag: XINT (show_flag) : SW_SHOWDEFAULT)) > 32) return Qt; - error ("ShellExecute failed: %s", w32_strerror (0)); + errstr = w32_strerror (0); + /* The error string might be encoded in the locale's encoding. */ + if (!NILP (Vlocale_coding_system)) + { + Lisp_Object decoded = + code_convert_string_norecord (make_unibyte_string (errstr, + strlen (errstr)), + Vlocale_coding_system, 0); + errstr = (char *)SDATA (decoded); + } + error ("ShellExecute failed: %s", errstr); } /* Lookup virtual keycode from string representing the name of a -- 2.11.4.GIT