summaryrefslogtreecommitdiff
path: root/gmodule
diff options
context:
space:
mode:
authorTor Lillqvist <tml@novell.com>2008-09-26 09:16:25 +0000
committerTor Lillqvist <tml@src.gnome.org>2008-09-26 09:16:25 +0000
commit30f2323d621552378ca3165e0dd373c3613e9a53 (patch)
tree002ef6bf6733c808f95a16a438baa8550a10d1e8 /gmodule
parentfc542a462a750f19b8fb06fcecc6f2034ec86d59 (diff)
Improve error reporting: When g_module_open() fails, include the name of
2008-09-26 Tor Lillqvist <tml@novell.com> * gmodule-win32.c: Improve error reporting: When g_module_open() fails, include the name of the module passed to LoadLibrary() in what g_module_error() returns. svn path=/trunk/; revision=7543
Diffstat (limited to 'gmodule')
-rw-r--r--gmodule/ChangeLog6
-rw-r--r--gmodule/gmodule-win32.c26
2 files changed, 26 insertions, 6 deletions
diff --git a/gmodule/ChangeLog b/gmodule/ChangeLog
index baf0578ca..1f6028db0 100644
--- a/gmodule/ChangeLog
+++ b/gmodule/ChangeLog
@@ -1,3 +1,9 @@
+2008-09-26 Tor Lillqvist <tml@novell.com>
+
+ * gmodule-win32.c: Improve error reporting: When g_module_open()
+ fails, include the name of the module passed to LoadLibrary() in
+ what g_module_error() returns.
+
2008-09-17 Matthias Clasen <mclasen@redhat.com>
* === Released 2.18.1 ===
diff --git a/gmodule/gmodule-win32.c b/gmodule/gmodule-win32.c
index 7dba30e1c..98d3fb9c6 100644
--- a/gmodule/gmodule-win32.c
+++ b/gmodule/gmodule-win32.c
@@ -42,11 +42,25 @@
#endif
static void
-set_error (void)
+set_error (const gchar *format,
+ ...)
{
- gchar *error = g_win32_error_message (GetLastError ());
+ gchar *error;
+ gchar *detail;
+ gchar *message;
+ va_list args;
- g_module_set_error (error);
+ error = g_win32_error_message (GetLastError ());
+
+ va_start (args, format);
+ detail = g_strdup_vprintf (format, args);
+ va_end (args);
+
+ message = g_strconcat (detail, error, NULL);
+
+ g_module_set_error (message);
+ g_free (message);
+ g_free (detail);
g_free (error);
}
@@ -70,7 +84,7 @@ _g_module_open (const gchar *file_name,
g_free (wfilename);
if (!handle)
- set_error ();
+ set_error ("`%s': ", file_name);
return handle;
}
@@ -90,7 +104,7 @@ _g_module_close (gpointer handle,
{
if (handle != null_module_handle)
if (!FreeLibrary (handle))
- set_error ();
+ set_error ("");
}
static gpointer
@@ -219,7 +233,7 @@ _g_module_symbol (gpointer handle,
p = GetProcAddress (handle, symbol_name);
if (!p)
- set_error ();
+ set_error ("");
return p;
}