summaryrefslogtreecommitdiff
path: root/gconf/gconfd.c
diff options
context:
space:
mode:
authorHavoc Pennington <hp@pobox.com>1999-10-04 23:27:43 +0000
committerHavoc Pennington <hp@src.gnome.org>1999-10-04 23:27:43 +0000
commit99b61f0b48db21235690ef892b898b92bbf35ddd (patch)
tree4c205d4a1f056e04709c1232b27f1e086a6ebfba /gconf/gconfd.c
parentee12741d2c641d98173abe1f7805901deadd2d09 (diff)
downloadgconf-99b61f0b48db21235690ef892b898b92bbf35ddd.tar.gz
Add checks for getting/setting lists, bools, floats, and ints
1999-10-04 Havoc Pennington <hp@pobox.com> * tests/testgconf.c (main): Add checks for getting/setting lists, bools, floats, and ints * gconf/gconf-internals.c (fill_corba_value_from_g_conf_value): We have to set the release flag on a sequence inside a union, since the sequence isn't default initialized as it normally would be. Plugs a big memory leak (all sequence buffers). * backends/xml-backend.c (dir_fill_cache_from_doc): Plug a leak where we set entry->name and then reset it in entry_fill() (entry_destroy): Free entry->mod_user (x_shutdown): Renamed shutdown() to x_shutdown() to avoid namespace clash with some libcs. Bug report from Bjorn Andersson <ban@lifix.fi>. * gconf/gconf-internals.c (g_conf_log): Plug memory leak (not freeing log string) * gconf/gconfd.c (gconfd_set): Plug memory leak (not freeing the GConfValue) * tests/Makefile.am: Make testgconf noinst * gconf/gconfd.c (main): check GCONFD_NO_DAEMON environment variable to run in no-daemon mode for debugging. Needless to say this does NOT work if you are trying to use gconf for real. * gconf/gconf-internals.c (fill_corba_value_from_g_conf_value): Fill in the list type in the CORBA value (g_conf_value_from_corba_value): Fill in the list type in the GConfValue * gconf/GConf.idl: Create ConfigList type to past the list type along with the sequence of values * gconf/gconf-value.c (g_conf_value_set_list): New function, list setter that copies the list * gconf/gconf.c (g_conf_unset, g_conf_set): return boolean to indicate success * gconf/gconf-value.c (g_conf_value_new_from_string): Rewrite the bool string parser with switch, accept y/n as values.
Diffstat (limited to 'gconf/gconfd.c')
-rw-r--r--gconf/gconfd.c53
1 files changed, 35 insertions, 18 deletions
diff --git a/gconf/gconfd.c b/gconf/gconfd.c
index 359e8fd5..c5f41779 100644
--- a/gconf/gconfd.c
+++ b/gconf/gconfd.c
@@ -367,6 +367,8 @@ gconfd_set(PortableServer_Servant servant,
context_set(gcc, key, val, value);
g_conf_set_exception(ev);
+
+ g_conf_value_destroy(val);
}
static void
@@ -679,11 +681,9 @@ g_conf_server_write_info_file(const gchar* ior)
g_free(dir);
return FALSE;
}
- else
- {
- g_free(dir);
- }
}
+
+ g_free(dir);
}
/* Can't O_TRUNC until we have the silly lock */
@@ -824,25 +824,36 @@ main(int argc, char** argv)
const gchar* username;
guint len;
GConfError* err = NULL;
+ gchar* nodaemon_var;
+ gboolean nodaemon = FALSE;
int launcher_fd = -1; /* FD passed from the client that spawned us */
- /* Following all Stevens' rules for daemons */
-
- switch (fork())
+ nodaemon_var = g_getenv("GCONFD_NO_DAEMON");
+
+ if (nodaemon_var && strcmp(nodaemon_var, "1") == 0)
+ nodaemon = TRUE;
+
+ if (!nodaemon)
{
- case -1:
- fprintf(stderr, _("Failed to fork gconfd"));
- exit(1);
- break;
- case 0:
- break;
- default:
- exit(0);
- break;
+ /* Following all Stevens' rules for daemons, unless the GCONFD_NO_DAEMON env variable
+ is set to 1 */
+
+ switch (fork())
+ {
+ case -1:
+ fprintf(stderr, _("Failed to fork gconfd"));
+ exit(1);
+ break;
+ case 0:
+ break;
+ default:
+ exit(0);
+ break;
+ }
+
+ setsid();
}
-
- setsid();
chdir ("/");
@@ -861,6 +872,9 @@ main(int argc, char** argv)
g_conf_log(GCL_INFO, _("starting, pid %u user `%s'"),
(guint)getpid(), g_get_user_name());
+ if (nodaemon)
+ g_conf_log(GCL_INFO, _("starting in debug (no daemon) mode"));
+
/* Session setup */
sigemptyset (&empty_mask);
act.sa_handler = signal_handler;
@@ -906,6 +920,9 @@ main(int argc, char** argv)
launcher_fd = atoi(argv[1]);
g_conf_log(GCL_DEBUG, _("Will notify launcher client on fd %d"), launcher_fd);
+
+ if (nodaemon)
+ g_conf_log(GCL_WARNING, _("GCONFD_NO_DAEMON environment variable is set to 1, but we are being launched as if from a GConf client"));
}
init_contexts();