diff options
author | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2006-04-12 18:09:26 +0000 |
---|---|---|
committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2006-04-12 18:09:26 +0000 |
commit | 2c99851181a652358aa3ca58ef38c57e46ae02e4 (patch) | |
tree | 6893f7992748817b64ec66947adc2ca40e13fb8e /libbb | |
parent | dac7ff15b7d32deeeef3d9665744fc5774c21d70 (diff) |
- patch from Denis Vlasenko to add and use bb_xdaemon()
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/Makefile.in | 2 | ||||
-rw-r--r-- | libbb/bb_xdaemon.c | 17 |
2 files changed, 18 insertions, 1 deletions
diff --git a/libbb/Makefile.in b/libbb/Makefile.in index c69978370..3fb945e31 100644 --- a/libbb/Makefile.in +++ b/libbb/Makefile.in @@ -30,7 +30,7 @@ LIBBB-y:= \ trim.c u_signal_names.c vdprintf.c verror_msg.c \ vherror_msg.c vperror_msg.c wfopen.c xconnect.c xgetcwd.c xstat.c \ xgethostbyname.c xgethostbyname2.c xreadlink.c xregcomp.c xgetlarg.c \ - bb_xsocket.c \ + bb_xsocket.c bb_xdaemon.c \ get_terminal_width_height.c fclose_nonstdin.c fflush_stdout_and_exit.c \ getopt_ulflags.c default_error_retval.c wfopen_input.c speed_table.c \ perror_nomsg_and_die.c perror_nomsg.c skip_whitespace.c bb_askpass.c \ diff --git a/libbb/bb_xdaemon.c b/libbb/bb_xdaemon.c new file mode 100644 index 000000000..a40f4f993 --- /dev/null +++ b/libbb/bb_xdaemon.c @@ -0,0 +1,17 @@ +/* vi: set sw=4 ts=4: */ +/* + * bb_xdaemon.c - a daemon() which dies on failure with error message + * + * Copyright (C) 2006 Denis Vlasenko + * + * Licensed under LGPL, see file docs/lesser.txt in this tarball for details. + */ +#include <unistd.h> +#include "libbb.h" + +void bb_xdaemon(int nochdir, int noclose) +{ + if (daemon(nochdir, noclose)) + bb_perror_msg_and_die("daemon"); +} + |