Patchwork [1,of,3] exewrapper: report name of failed DLL in error message

login
register
mail settings
Submitter Adrian Buehlmann
Date Oct. 14, 2015, 10:38 a.m.
Message ID <b8bf5a263a32ff73a4da.1444819093@kork>
Download mbox | patch
Permalink /patch/11044/
State Accepted
Headers show

Comments

Adrian Buehlmann - Oct. 14, 2015, 10:38 a.m.
# HG changeset patch
# User Adrian Buehlmann <adrian@cadifra.com>
# Date 1444818129 -7200
# Node ID b8bf5a263a32ff73a4da0ba1512c0f1c42b49b88
# Parent  79d86ab65c9def3fdd65ec972bc5fa89688a19ff
exewrapper: report name of failed DLL in error message

This uses C string literal concatenation.

Example output:

  $ hg version
  abort: failed to load Python DLL python27.dll

Note that HGPYTHONLIB does not contain the trailing .dll, which works here
because the dcoumentation of LoadLibrary [1] says, that if no file name
extension is specified in the filename parameter, the default library
extension .dll is appended.

See [2] for a motivation of this change.

[1] https://msdn.microsoft.com/en-us/library/windows/desktop/ms684175(v=vs.85).aspx
[2] https://selenic.com/pipermail/mercurial/2015-August/048627.html

Patch

diff --git a/mercurial/exewrapper.c b/mercurial/exewrapper.c
--- a/mercurial/exewrapper.c
+++ b/mercurial/exewrapper.c
@@ -106,7 +106,7 @@ 
 	if (pydll == NULL) {
 		pydll = LoadLibrary(HGPYTHONLIB);
 		if (pydll == NULL) {
-			err = "failed to load Python DLL";
+			err = "failed to load Python DLL " HGPYTHONLIB ".dll";
 			goto bail;
 		}
 	}