close (fd);
if (fd > 2) close (fd);
daemonify (void){    pid_t pid;    int fd;    pid = fork ();    if (pid < 0)	arla_err (1, ADEBERROR, errno, "fork");    else if (pid > 0)	exit(0);    if (setsid() == -1)	arla_err (1, ADEBERROR, errno, "setsid");    fd = open(_PATH_DEVNULL, O_RDWR, 0);    if (fd < 0)	arla_err (1, ADEBERROR, errno, "open " _PATH_DEVNULL);    dup2 (fd, STDIN_FILENO);    dup2 (fd, STDOUT_FILENO);    dup2 (fd, STDERR_FILENO);    close (fd);}