diff options
author | kay.sievers@vrfy.org <kay.sievers@vrfy.org> | 2005-01-16 04:06:22 +0100 |
---|---|---|
committer | Greg KH <gregkh@suse.de> | 2005-04-26 23:21:58 -0700 |
commit | f15515b59ff373c3b9524a0842e96c1d105f5a62 (patch) | |
tree | d5018944713abae3b59c52bc8d3d27f509781e6f /udevd.c | |
parent | 78b574cfcde57a93994f73ee6aca31e499b9dd09 (diff) |
[PATCH] udevd: support -d switch to become a daemon
Diffstat (limited to 'udevd.c')
-rw-r--r-- | udevd.c | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -472,6 +472,24 @@ int main(int argc, char *argv[], char *envp[]) goto exit; } + /* daemonize on request */ + if (argc == 2 && strcmp(argv[1], "-d") == 0) { + pid_t pid; + + pid = fork(); + switch (pid) { + case 0: + dbg("damonized fork running"); + break; + case -1: + dbg("fork of daemon failed"); + goto exit; + default: + logging_close(); + exit(0); + } + } + /* make sure we don't lock any path */ chdir("/"); umask(umask(077) | 022); |