git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@3581 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Johan Danielsson
1997-10-04 21:55:48 +00:00
parent aca425f0e9
commit c0896c4709

View File

@@ -56,8 +56,7 @@ RCSID("$Id$");
#include "roken.h"
int
daemon(nochdir, noclose)
int nochdir, noclose;
daemon(int nochdir, int noclose)
{
int fd;
@@ -74,14 +73,14 @@ daemon(nochdir, noclose)
return (-1);
if (!nochdir)
(void)chdir("/");
chdir("/");
if (!noclose && (fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) {
(void)dup2(fd, STDIN_FILENO);
(void)dup2(fd, STDOUT_FILENO);
(void)dup2(fd, STDERR_FILENO);
dup2(fd, STDIN_FILENO);
dup2(fd, STDOUT_FILENO);
dup2(fd, STDERR_FILENO);
if (fd > 2)
(void)close (fd);
close (fd);
}
return (0);
}