summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRalf Habacker <ralf.habacker@freenet.de>2011-10-28 21:22:53 +0200
committerRalf Habacker <ralf.habacker@freenet.de>2011-10-28 21:22:53 +0200
commit93e9941de6908f731e3f9b0fac1083f0e9a47dd5 (patch)
tree6eb47a3bb0fb41ea7b82775758b56f9f8119e452
parentd52b86d3e774ed515039f47b2a35ec645362a97b (diff)
Optimized error handling of previous patch
-rw-r--r--dbus/dbus-sysdeps-win.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/dbus/dbus-sysdeps-win.c b/dbus/dbus-sysdeps-win.c
index 3bcf86ac..aea704d2 100644
--- a/dbus/dbus-sysdeps-win.c
+++ b/dbus/dbus-sysdeps-win.c
@@ -2862,20 +2862,35 @@ _dbus_get_autolaunch_address (const char *scope, DBusString *address,
if (!SearchPathA(NULL, daemon_name, NULL, sizeof(dbus_exe_path), dbus_exe_path, &lpFile))
{
// Look in directory containing dbus shared library
- HMODULE hmod = _dbus_win_get_dll_hmodule();
+ HMODULE hmod;
char dbus_module_path[MAX_PATH];
- DWORD rc = GetModuleFileNameA(hmod, dbus_module_path, sizeof(dbus_module_path));
- if (rc > 0)
+ DWORD rc;
+
+ _dbus_verbose( "did not found dbus daemon executable on default search path, "
+ "trying path where dbus shared library is located");
+
+ hmod = _dbus_win_get_dll_hmodule();
+ rc = GetModuleFileNameA(hmod, dbus_module_path, sizeof(dbus_module_path));
+ if (rc <= 0)
+ {
+ dbus_set_error_const (error, DBUS_ERROR_FAILED, "could not retrieve dbus shared library file name");
+ retval = FALSE;
+ goto out;
+ }
+ else
{
char *ext_idx = strrchr(dbus_module_path, '\\');
if (ext_idx)
*ext_idx = '\0';
if (!SearchPathA(dbus_module_path, daemon_name, NULL, sizeof(dbus_exe_path), dbus_exe_path, &lpFile))
{
+ dbus_set_error_const (error, DBUS_ERROR_FAILED, "could not find dbus-daemon executable");
+ retval = FALSE;
printf ("please add the path to %s to your PATH environment variable\n", daemon_name);
printf ("or start the daemon manually\n\n");
goto out;
}
+ _dbus_verbose( "found dbus daemon executable at %s",dbus_module_path);
}
}