Commit 1d421e52 authored by Colin Walters's avatar Colin Walters
Browse files

2004-11-11 Colin Walters <walters@verbum.org>

	* src/NetworkManager.c (main): Use daemon(3).

	* info-daemon/NetworkManagerInfo.c (main): Ditto.

	* dispatcher-daemon/NetworkManagerDispatcher.c (main): Ditto.


git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@304 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
parent 237172d0
2004-11-11 Colin Walters <walters@verbum.org>
* src/NetworkManager.c (main): Use daemon(3).
* info-daemon/NetworkManagerInfo.c (main): Ditto.
* dispatcher-daemon/NetworkManagerDispatcher.c (main): Ditto.
2004-11-10 Dan Williams <dcbw@redhat.com>
Patches from j bootlab org
......
......@@ -379,31 +379,10 @@ int main( int argc, char *argv[] )
openlog("NetworkManagerDispatcher", (become_daemon) ? LOG_CONS : LOG_CONS | LOG_PERROR, (become_daemon) ? LOG_DAEMON : LOG_USER);
if (become_daemon)
if (become_daemon && daemon (FALSE, FALSE) < 0)
{
int child_pid;
if (chdir ("/") < 0)
{
syslog( LOG_CRIT, "NetworkManagerDispatcher could not chdir to /. errno=%d", errno);
return 1;
}
child_pid = fork ();
switch (child_pid)
{
case -1:
syslog( LOG_ERR, "NetworkManagerDispatcher could not daemonize. errno = %d", errno );
break;
case 0:
/* Child */
break;
default:
exit (0);
break;
}
syslog( LOG_ERR, "NetworkManagerDispatcher could not daemonize. errno = %d", errno );
exit (1);
}
g_type_init ();
......
......@@ -201,31 +201,10 @@ int main( int argc, char *argv[] )
openlog("NetworkManagerInfo", (no_daemon) ? LOG_CONS | LOG_PERROR : LOG_CONS, (no_daemon) ? LOG_USER : LOG_DAEMON);
if (!no_daemon)
if (!no_daemon && daemon (FALSE, FALSE) < 0)
{
int child_pid;
if (chdir ("/") < 0)
{
syslog( LOG_CRIT, "NetworkManagerInfo could not chdir to /. errno=%d", errno);
return 1;
}
child_pid = fork ();
switch (child_pid)
{
case -1:
syslog( LOG_ERR, "NetworkManagerInfo could not daemonize. errno = %d", errno );
break;
case 0:
/* Child */
break;
default:
exit (0);
break;
}
syslog( LOG_ERR, "NetworkManagerInfo could not daemonize. errno = %d", errno );
exit (1);
}
app_info = g_new0 (NMIAppInfo, 1);
......
......@@ -710,31 +710,10 @@ int main( int argc, char *argv[] )
/* Keep a current list of access points */
wireless_scan_source = g_timeout_add (10000, nm_wireless_scan_monitor, nm_data);
if (become_daemon)
if (become_daemon && daemon (0, 0) < 0)
{
int child_pid;
if (chdir ("/") < 0)
{
syslog( LOG_CRIT, "NetworkManager could not chdir to /. errno=%d", errno);
return (1);
}
child_pid = fork ();
switch (child_pid)
{
case -1:
syslog( LOG_ERR, "NetworkManager could not daemonize. errno = %d", errno );
break;
case 0:
/* Child */
break;
default:
exit (EXIT_SUCCESS);
break;
}
syslog( LOG_ERR, "NetworkManager could not daemonize. errno = %d", errno );
exit (1);
}
/* Wheeee!!! */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment