dbus/bus bus.c,1.55,1.56 bus.h,1.25,1.26 main.c,1.26,1.27
David Zeuthen
david at freedesktop.org
Sun Sep 12 10:23:45 UTC 2004
Update of /cvs/dbus/dbus/bus
In directory gabe:/tmp/cvs-serv18517/bus
Modified Files:
bus.c bus.h main.c
Log Message:
2004-09-12 David Zeuthen <david at fubar.dk>
Patch from Kay Sievers <kay.sievers at vrfy.org>
* bus/bus.c (bus_context_new):
* bus/bus.h:
* bus/main.c (usage)
(main):
Add commandline option --nofork to override configuration file
setting.
Index: bus.c
===================================================================
RCS file: /cvs/dbus/dbus/bus/bus.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -d -r1.55 -r1.56
--- bus.c 10 Aug 2004 21:32:25 -0000 1.55
+++ bus.c 12 Sep 2004 10:23:41 -0000 1.56
@@ -537,7 +537,7 @@
BusContext*
bus_context_new (const DBusString *config_file,
- dbus_bool_t force_fork,
+ ForceForkSetting force_fork,
int print_addr_fd,
int print_pid_fd,
DBusError *error)
@@ -656,7 +656,7 @@
}
/* Now become a daemon if appropriate */
- if (force_fork || context->fork)
+ if ((force_fork != FORK_NEVER && context->fork) || force_fork == FORK_ALWAYS)
{
DBusString u;
Index: bus.h
===================================================================
RCS file: /cvs/dbus/dbus/bus/bus.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- bus.h 10 Aug 2004 03:06:59 -0000 1.25
+++ bus.h 12 Sep 2004 10:23:42 -0000 1.26
@@ -61,8 +61,15 @@
int reply_timeout; /**< How long to wait before timing out a reply */
} BusLimits;
+typedef enum
+{
+ FORK_FOLLOW_CONFIG_FILE,
+ FORK_ALWAYS,
+ FORK_NEVER
+} ForceForkSetting;
+
BusContext* bus_context_new (const DBusString *config_file,
- dbus_bool_t force_fork,
+ ForceForkSetting force_fork,
int print_addr_fd,
int print_pid_fd,
DBusError *error);
Index: main.c
===================================================================
RCS file: /cvs/dbus/dbus/bus/main.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- main.c 10 Aug 2004 21:32:25 -0000 1.26
+++ main.c 12 Sep 2004 10:23:42 -0000 1.27
@@ -62,7 +62,7 @@
static void
usage (void)
{
- fprintf (stderr, "dbus-daemon-1 [--version] [--session] [--system] [--config-file=FILE] [--print-address[=DESCRIPTOR]] [--print-pid[=DESCRIPTOR]] [--fork]\n");
+ fprintf (stderr, "dbus-daemon-1 [--version] [--session] [--system] [--config-file=FILE] [--print-address[=DESCRIPTOR]] [--print-pid[=DESCRIPTOR]] [--fork] [--nofork]\n");
exit (1);
}
@@ -200,8 +200,8 @@
int i;
dbus_bool_t print_address;
dbus_bool_t print_pid;
- dbus_bool_t force_fork;
-
+ int force_fork;
+
if (!_dbus_string_init (&config_file))
return 1;
@@ -210,25 +210,27 @@
if (!_dbus_string_init (&pid_fd))
return 1;
-
+
print_address = FALSE;
print_pid = FALSE;
- force_fork = FALSE;
-
+ force_fork = FORK_FOLLOW_CONFIG_FILE;
+
prev_arg = NULL;
i = 1;
while (i < argc)
{
const char *arg = argv[i];
-
+
if (strcmp (arg, "--help") == 0 ||
strcmp (arg, "-h") == 0 ||
strcmp (arg, "-?") == 0)
usage ();
else if (strcmp (arg, "--version") == 0)
version ();
+ else if (strcmp (arg, "--nofork") == 0)
+ force_fork = FORK_NEVER;
else if (strcmp (arg, "--fork") == 0)
- force_fork = TRUE;
+ force_fork = FORK_ALWAYS;
else if (strcmp (arg, "--system") == 0)
{
check_two_config_files (&config_file, "system");
More information about the dbus-commit
mailing list