summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2003-04-09 00:27:41 +0000
committerHavoc Pennington <hp@redhat.com>2003-04-09 00:27:41 +0000
commit0e1945b3889f8be8e31e39ad2b982c8a192be41d (patch)
tree2875bfa498c923d983b2fc6cbba37988373db357
parent0366385618ccc26789fdf3a9cc35ee038de071f6 (diff)
2003-04-08 Colin Walters <walters@gnu.org>
* bus/bus.c (struct BusContext) [pidfile]: New member, to store the pid file. (bus_context_new): Set it. (bus_context_unref): Use it to delete the pid file.
-rw-r--r--ChangeLog7
-rw-r--r--bus/bus.c18
2 files changed, 25 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 471eb8ae..d5624a29 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2003-04-08 Colin Walters <walters@gnu.org>
+
+ * bus/bus.c (struct BusContext) [pidfile]: New member, to store
+ the pid file.
+ (bus_context_new): Set it.
+ (bus_context_unref): Use it to delete the pid file.
+
2003-04-08 Havoc Pennington <hp@redhat.com>
* test/data/invalid-messages/array-with-mixed-types.message:
diff --git a/bus/bus.c b/bus/bus.c
index ee40e539..d8d2a9c1 100644
--- a/bus/bus.c
+++ b/bus/bus.c
@@ -37,6 +37,7 @@ struct BusContext
int refcount;
char *type;
char *address;
+ char *pidfile;
DBusLoop *loop;
DBusList *servers;
BusConnections *connections;
@@ -632,6 +633,9 @@ bus_context_new (const DBusString *config_file,
goto failed;
}
}
+
+ /* keep around the pid filename so we can delete it later */
+ context->pidfile = _dbus_strdup (pidfile);
bus_config_parser_unref (parser);
_dbus_string_free (&full_address);
@@ -760,6 +764,20 @@ bus_context_unref (BusContext *context)
dbus_free (context->type);
dbus_free (context->address);
+
+ if (context->pidfile)
+ {
+ DBusString u;
+ _dbus_string_init_const (&u, context->pidfile);
+
+ /* Deliberately ignore errors here, since there's not much
+ * we can do about it, and we're exiting anyways.
+ */
+ _dbus_delete_file (&u, NULL);
+
+ dbus_free (context->pidfile);
+ }
+
dbus_free (context);
server_data_slot_unref ();