summaryrefslogtreecommitdiff
path: root/daemon.c
diff options
context:
space:
mode:
authorBrad Fitzpatrick <brad@danga.com>2006-09-04 02:23:19 +0000
committerBrad Fitzpatrick <brad@danga.com>2006-09-04 02:23:19 +0000
commit1ea89bd54442d4040d50aad91e1c86bfeeddc723 (patch)
tree14c12e999e9f0cc25234b775ad9967334b72ba2d /daemon.c
parent93c6642e49de4a6b1bd52955efcea6968bb69920 (diff)
downloadmemcached-1ea89bd54442d4040d50aad91e1c86bfeeddc723.tar.gz
remove all trailing whitespace, not just first occurrence. :)
git-svn-id: http://code.sixapart.com/svn/memcached/trunk/server@329 b0b603af-a30f-0410-a34e-baf09ae79d0b
Diffstat (limited to 'daemon.c')
-rw-r--r--daemon.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/daemon.c b/daemon.c
index b80c53e..84cff4e 100644
--- a/daemon.c
+++ b/daemon.c
@@ -28,22 +28,18 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-
#if defined __SUNPRO_C || defined __DECC || defined __HP_cc
# pragma ident "@(#)$Header: /cvsroot/wikipedia/willow/src/bin/willow/daemon.c,v 1.1 2005/05/02 19:15:21 kateturner Exp $"
# pragma ident "$NetBSD: daemon.c,v 1.9 2003/08/07 16:42:46 agc Exp $"
#endif
-
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
-
int
daemon(nochdir, noclose)
int nochdir, noclose;
{
int fd;
-
switch (fork()) {
case -1:
return (-1);
@@ -52,13 +48,10 @@ daemon(nochdir, noclose)
default:
_exit(0);
}
-
if (setsid() == -1)
return (-1);
-
if (!nochdir)
(void)chdir("/");
-
if (!noclose && (fd = open("/dev/null", O_RDWR, 0)) != -1) {
(void)dup2(fd, STDIN_FILENO);
(void)dup2(fd, STDOUT_FILENO);
@@ -67,4 +60,4 @@ daemon(nochdir, noclose)
(void)close(fd);
}
return (0);
-}
+} \ No newline at end of file