diff options
author | Yaakov Selkowitz <yselkowitz@users.sourceforge.net> | 2010-08-09 09:01:52 +0200 |
---|---|---|
committer | Ralf Habacker <ralf.habacker@freenet.de> | 2010-08-10 08:25:47 +0200 |
commit | 0e31935343644bb3eba77e2a1f4699ead3b33625 (patch) | |
tree | cf2330107b80b7a8f0442d5d39c9e3ba7bf7a616 | |
parent | e5d0069c8f2b047b062df03052b7a997ab30c3ca (diff) | |
download | dbus-0e31935343644bb3eba77e2a1f4699ead3b33625.tar.gz |
Delete stale pid file on cygwin.
-rw-r--r-- | bus/bus.c | 20 | ||||
-rw-r--r-- | configure.in | 4 |
2 files changed, 24 insertions, 0 deletions
@@ -36,6 +36,7 @@ #include <dbus/dbus-hash.h> #include <dbus/dbus-credentials.h> #include <dbus/dbus-internals.h> +#include <signal.h> struct BusContext { @@ -311,10 +312,29 @@ process_config_first_time_only (BusContext *context, if (_dbus_stat (&u, &stbuf, NULL)) { +#ifdef DBUS_CYGWIN + DBusString p; + long /* int */ pid; + + _dbus_string_init (&p); + _dbus_file_get_contents(&p, &u, NULL); + _dbus_string_parse_int(&p, 0, &pid, NULL); + _dbus_string_free(&p); + + if ((kill((int)pid, 0))) { + dbus_set_error(NULL, DBUS_ERROR_FILE_EXISTS, + "pid %ld not running, removing stale pid file\n", + pid); + _dbus_delete_file(&u, NULL); + } else { +#endif dbus_set_error (error, DBUS_ERROR_FAILED, "The pid file \"%s\" exists, if the message bus is not running, remove this file", pidfile); goto failed; +#ifdef DBUS_CYGWIN + } +#endif } } diff --git a/configure.in b/configure.in index 733fe58d..ad849c7f 100644 --- a/configure.in +++ b/configure.in @@ -110,10 +110,14 @@ if test "$dbus_win" = yes; then else AC_DEFINE(DBUS_UNIX,1,[Defined if we run on a Unix-based system]) fi +if test "$dbus_cygwin" = yes; then + AC_DEFINE(DBUS_CYGWIN,1,[Defined if we run on a cygwin API based system]) +fi AM_CONDITIONAL(DBUS_WIN, test "$dbus_win" = yes) AM_CONDITIONAL(DBUS_WINCE, test "$dbus_wince" = yes) AM_CONDITIONAL(DBUS_UNIX, test "$dbus_unix" = yes) +AM_CONDITIONAL(DBUS_CYGWIN, test "$dbus_cygwin" = yes) AC_ARG_ENABLE(tests, AS_HELP_STRING([--enable-tests],[enable unit test code]),enable_tests=$enableval,enable_tests=$USE_MAINTAINER_MODE) AC_ARG_ENABLE(ansi, AS_HELP_STRING([--enable-ansi],[enable -ansi -pedantic gcc flags]),enable_ansi=$enableval,enable_ansi=no) |