diff options
author | Mukund Sivaraman <muks@banu.com> | 2008-12-01 15:01:11 +0000 |
---|---|---|
committer | Mukund Sivaraman <muks@banu.com> | 2008-12-01 15:01:11 +0000 |
commit | a257703e59163b4f38c38f549179b8e45ac68c63 (patch) | |
tree | d056783c13f4adb25c133899f5d750a2b7123a2f /src/daemon.c | |
parent | 448c19077c195fafd244539eeb5315773261fcaf (diff) |
Reformat code to GNU coding style
This is a commit which simply ran all C source code files
through GNU indent. No other modifications were made.
Diffstat (limited to 'src/daemon.c')
-rw-r--r-- | src/daemon.c | 61 |
1 files changed, 32 insertions, 29 deletions
diff --git a/src/daemon.c b/src/daemon.c index f0b0aba..fc39b42 100644 --- a/src/daemon.c +++ b/src/daemon.c @@ -30,28 +30,28 @@ * program a daemon process. */ void -makedaemon(void) +makedaemon (void) { - if (fork() != 0) - exit(0); + if (fork () != 0) + exit (0); - setsid(); - set_signal_handler(SIGHUP, SIG_IGN); + setsid (); + set_signal_handler (SIGHUP, SIG_IGN); - if (fork() != 0) - exit(0); + if (fork () != 0) + exit (0); - chdir("/"); - umask(0177); + chdir ("/"); + umask (0177); #if NDEBUG - /* - * When not in debugging mode, close the standard file - * descriptors. - */ - close(0); - close(1); - close(2); + /* + * When not in debugging mode, close the standard file + * descriptors. + */ + close (0); + close (1); + close (2); #endif } @@ -60,25 +60,28 @@ makedaemon(void) * to handle signals sent to the process. */ signal_func * -set_signal_handler(int signo, signal_func *func) +set_signal_handler (int signo, signal_func * func) { - struct sigaction act, oact; + struct sigaction act, oact; - act.sa_handler = func; - sigemptyset(&act.sa_mask); - act.sa_flags = 0; - if (signo == SIGALRM) { + act.sa_handler = func; + sigemptyset (&act.sa_mask); + act.sa_flags = 0; + if (signo == SIGALRM) + { #ifdef SA_INTERRUPT - act.sa_flags |= SA_INTERRUPT; /* SunOS 4.x */ + act.sa_flags |= SA_INTERRUPT; /* SunOS 4.x */ #endif - } else { + } + else + { #ifdef SA_RESTART - act.sa_flags |= SA_RESTART; /* SVR4, 4.4BSD */ + act.sa_flags |= SA_RESTART; /* SVR4, 4.4BSD */ #endif - } + } - if (sigaction(signo, &act, &oact) < 0) - return SIG_ERR; + if (sigaction (signo, &act, &oact) < 0) + return SIG_ERR; - return oact.sa_handler; + return oact.sa_handler; } |