summaryrefslogtreecommitdiffhomepage
path: root/src/daemon.c
diff options
context:
space:
mode:
authorRobert James Kaes <rjkaes@users.sourceforge.net>2005-08-15 03:54:31 +0000
committerRobert James Kaes <rjkaes@users.sourceforge.net>2005-08-15 03:54:31 +0000
commitc0299e1868312e623c9b2ec6646cc7d1a5fe0f69 (patch)
tree83ea37f76e53ce502bbd813f7f93ed99d4df9efa /src/daemon.c
parent38f0b3a10354cd2297ae173a07ade3acd1aebd9a (diff)
* [Indent] Ran Source Through indent
I re-indented the source code using indent with the following options: indent -kr -bad -bap -nut -i8 -l80 -psl -sob -ss -ncs There are now _no_ tabs in the source files, and all indentation is eight spaces. Lines are 80 characters long, and the procedure type is on it's own line. Read the indent manual for more information about what each option means.
Diffstat (limited to 'src/daemon.c')
-rw-r--r--src/daemon.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/src/daemon.c b/src/daemon.c
index f917283..9d4379a 100644
--- a/src/daemon.c
+++ b/src/daemon.c
@@ -1,4 +1,4 @@
-/* $Id: daemon.c,v 1.4 2005-07-12 17:39:43 rjkaes Exp $
+/* $Id: daemon.c,v 1.5 2005-08-15 03:54:31 rjkaes Exp $
*
* This file contains functions which are useful when writing a
* daemon process. The functions include a "makedaemon" function and
@@ -28,26 +28,26 @@
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(077);
+ chdir("/");
+ umask(077);
#if NDEBUG
/*
* When not in debugging mode, close the standard file
* descriptors.
*/
- close(0);
- close(1);
- close(2);
+ close(0);
+ close(1);
+ close(2);
#endif
}
@@ -56,25 +56,25 @@ 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;
}