On Thu, 2011-02-03 at 15:04 +0100, Petr Uzel wrote: > Signed-off-by: Petr Uzel <petr.uzel@xxxxxxx> > --- > misc-utils/uuidd.c | 19 ++----------------- > 1 files changed, 2 insertions(+), 17 deletions(-) > > diff --git a/misc-utils/uuidd.c b/misc-utils/uuidd.c > index 4a230fb..c5c58ae 100644 > --- a/misc-utils/uuidd.c > +++ b/misc-utils/uuidd.c > @@ -59,26 +59,11 @@ static void die(const char *msg) > > static void create_daemon(void) > { > - pid_t pid; > uid_t euid; > As per standard daemonizing processes (I've not looked over the uuidd code to see if the program creates files though): + umask(0); > - pid = fork(); > - if (pid == -1) { > - perror("fork"); > - exit(1); > - } else if (pid != 0) { > - exit(0); > - } > - > - close(0); > - close(1); > - close(2); > - open("/dev/null", O_RDWR); > - open("/dev/null", O_RDWR); > - open("/dev/null", O_RDWR); > + if (daemon(0,0)) > + die("daemon"); > > - if (chdir("/")) {} /* Silence warn_unused_result warning */ > - (void) setsid(); > euid = geteuid(); > if (setreuid(euid, euid) < 0) > die("setreuid"); -- To unsubscribe from this list: send the line "unsubscribe util-linux" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html