chiark / gitweb /
Import release 0.1.13
[secnet.git] / secnet.c
index 20f9999ed43834eb21d599ddb958a78162287d54..8987af35f65ee91059accec6963d7ddbc32c89f4 100644 (file)
--- a/secnet.c
+++ b/secnet.c
@@ -1,9 +1,3 @@
-/* $Log: secnet.c,v $
- * Revision 1.1  1996/03/13 22:27:41  sde1000
- * Initial revision
- *
- */
-
 extern char version[];
 
 #include "secnet.h"
@@ -281,7 +275,8 @@ static void run(void)
        if (gettimeofday(&tv_now, NULL)!=0) {
            fatal_perror("main loop: gettimeofday");
        }
-       now=(tv_now.tv_sec*1000)+(tv_now.tv_usec/1000);
+       now=((uint64_t)tv_now.tv_sec*(uint64_t)1000)+
+           ((uint64_t)tv_now.tv_usec/(uint64_t)1000);
        idx=0;
        for (i=reg; i; i=i->next) {
            i->after(i->state, fds+idx, i->nfds, &tv_now, &now);
@@ -356,10 +351,14 @@ static void droppriv(void)
            /* Child process - all done, just carry on */
            if (pf) fclose(pf);
            /* Close stdin, stdout and stderr; we don't need them any more */
+           /* XXX we must leave stderr pointing to something useful -
+               a pipe to a log destination, for example, or just leave
+               it alone. */
            close(0);
            close(1);
-           close(2);
+           /* XXX close(2); */
            secnet_is_daemon=True;
+           setsid();
        } else {
            /* Error */
            fatal_perror("cannot fork");