Daemonized improxy
authorThadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Wed, 27 Sep 2006 00:10:13 +0000 (00:10 +0000)
committerThadeu Lima de Souza Cascardo <cascardo@minaslivre.org>
Wed, 27 Sep 2006 00:10:13 +0000 (00:10 +0000)
First thing improxy does is to detach from its controlling terminal,
going into daemon mode. Since there is no portable way to do that
(using GLib would be very nice), it calls the libc daemon function.

improxy.c

index e69df59..cafc365 100644 (file)
--- a/improxy.c
+++ b/improxy.c
@@ -20,6 +20,7 @@
 #include <glib.h>
 #include <gnet.h>
 #include <stdio.h>
+#include <unistd.h>
 #include "log.h"
 #include "nethook.h"
 #include "proto_detect.h"
@@ -57,6 +58,8 @@ int main (int argc, char** argv)
   gchar* conf_address;
   gint port;
 
+  daemon (0, 0);
+
   gnet_init ();
   im_log_init ();