redundant since we call daemon() earlier.
ok bluhm@
-/* $OpenBSD: proc.c,v 1.43 2024/04/08 12:50:05 tobhe Exp $ */
+/* $OpenBSD: proc.c,v 1.44 2024/04/09 15:48:01 tobhe Exp $ */
/*
* Copyright (c) 2010 - 2016 Reyk Floeter <reyk@openbsd.org>
enum privsep_procid privsep_process;
void proc_exec(struct privsep *, struct privsep_proc *, unsigned int, int,
- int, char **);
+ char **);
void proc_setup(struct privsep *, struct privsep_proc *, unsigned int);
void proc_open(struct privsep *, int, int);
void proc_accept(struct privsep *, int, enum privsep_procid,
void
proc_exec(struct privsep *ps, struct privsep_proc *procs, unsigned int nproc,
- int debug, int argc, char **argv)
+ int argc, char **argv)
{
unsigned int proc, nargc, i, proc_i;
char **nargv;
fatal("%s: fork", __func__);
break;
case 0:
- /* First create a new session */
- if (setsid() == -1)
- fatal("setsid");
-
/* Prepare parent socket. */
if (fd != PROC_PARENT_SOCK_FILENO) {
if (dup2(fd, PROC_PARENT_SOCK_FILENO)
} else if (fcntl(fd, F_SETFD, 0) == -1)
fatal("fcntl");
- /* Daemons detach from terminal. */
- if (!debug && (fd =
- open(_PATH_DEVNULL, O_RDWR, 0)) != -1) {
- (void)dup2(fd, STDIN_FILENO);
- (void)dup2(fd, STDOUT_FILENO);
- (void)dup2(fd, STDERR_FILENO);
- if (fd > 2)
- (void)close(fd);
- }
-
execvp(argv[0], nargv);
fatal("%s: execvp", __func__);
break;
}
/* Engage! */
- proc_exec(ps, procs, nproc, debug, argc, argv);
+ proc_exec(ps, procs, nproc, argc, argv);
return;
}
log_procinit(p->p_title);
- /* Set the process group of the current process */
- setpgid(0, 0);
-
if (p->p_id == PROC_CONTROL && ps->ps_instance == 0) {
if (control_init(ps, &ps->ps_csock) == -1)
fatalx("%s: control_init", __func__);
-/* $OpenBSD: proc.c,v 1.44 2024/04/08 12:45:18 tobhe Exp $ */
+/* $OpenBSD: proc.c,v 1.45 2024/04/09 15:48:01 tobhe Exp $ */
/*
* Copyright (c) 2010 - 2016 Reyk Floeter <reyk@openbsd.org>
#include "httpd.h"
void proc_exec(struct privsep *, struct privsep_proc *, unsigned int, int,
- int, char **);
+ char **);
void proc_setup(struct privsep *, struct privsep_proc *, unsigned int);
void proc_open(struct privsep *, int, int);
void proc_accept(struct privsep *, int, enum privsep_procid,
void
proc_exec(struct privsep *ps, struct privsep_proc *procs, unsigned int nproc,
- int debug, int argc, char **argv)
+ int argc, char **argv)
{
unsigned int proc, nargc, i, proc_i;
char **nargv;
fatal("%s: fork", __func__);
break;
case 0:
- /* First create a new session */
- if (setsid() == -1)
- fatal("setsid");
-
/* Prepare parent socket. */
if (fd != PROC_PARENT_SOCK_FILENO) {
if (dup2(fd, PROC_PARENT_SOCK_FILENO)
} else if (fcntl(fd, F_SETFD, 0) == -1)
fatal("fcntl");
- /* Daemons detach from terminal. */
- if (!debug && (fd =
- open(_PATH_DEVNULL, O_RDWR, 0)) != -1) {
- (void)dup2(fd, STDIN_FILENO);
- (void)dup2(fd, STDOUT_FILENO);
- (void)dup2(fd, STDERR_FILENO);
- if (fd > 2)
- (void)close(fd);
- }
-
execvp(argv[0], nargv);
fatal("%s: execvp", __func__);
break;
}
/* Engage! */
- proc_exec(ps, procs, nproc, debug, argc, argv);
+ proc_exec(ps, procs, nproc, argc, argv);
return;
}
log_procinit(p->p_title);
- /* Set the process group of the current process */
- setpgid(0, 0);
-
if (p->p_id == PROC_CONTROL && ps->ps_instance == 0) {
if (control_init(ps, &ps->ps_csock) == -1)
fatalx("%s: control_init", __func__);
-/* $OpenBSD: proc.c,v 1.31 2024/04/08 13:18:54 tobhe Exp $ */
+/* $OpenBSD: proc.c,v 1.32 2024/04/09 15:48:01 tobhe Exp $ */
/*
* Copyright (c) 2010 - 2016 Reyk Floeter <reyk@openbsd.org>
#include "snmpd.h"
void proc_exec(struct privsep *, struct privsep_proc *, unsigned int, int,
- int, char **);
+ char **);
void proc_setup(struct privsep *, struct privsep_proc *, unsigned int);
void proc_open(struct privsep *, int, int);
void proc_accept(struct privsep *, int, enum privsep_procid,
void
proc_exec(struct privsep *ps, struct privsep_proc *procs, unsigned int nproc,
- int debug, int argc, char **argv)
+ int argc, char **argv)
{
unsigned int proc, nargc, i, proc_i;
char **nargv;
fatal("%s: fork", __func__);
break;
case 0:
- /* First create a new session */
- if (setsid() == -1)
- fatal("setsid");
-
/* Prepare parent socket. */
if (fd != PROC_PARENT_SOCK_FILENO) {
if (dup2(fd, PROC_PARENT_SOCK_FILENO)
} else if (fcntl(fd, F_SETFD, 0) == -1)
fatal("fcntl");
- /* Daemons detach from terminal. */
- if (!debug && (fd =
- open(_PATH_DEVNULL, O_RDWR, 0)) != -1) {
- (void)dup2(fd, STDIN_FILENO);
- (void)dup2(fd, STDOUT_FILENO);
- (void)dup2(fd, STDERR_FILENO);
- if (fd > 2)
- (void)close(fd);
- }
-
execvp(argv[0], nargv);
fatal("%s: execvp", __func__);
break;
}
/* Engage! */
- proc_exec(ps, procs, nproc, debug, argc, argv);
+ proc_exec(ps, procs, nproc, argc, argv);
return;
}
log_procinit(p->p_title);
- /* Set the process group of the current process */
- setpgid(0, 0);
-
/* Use non-standard user */
if (p->p_pw != NULL)
pw = p->p_pw;
-/* $OpenBSD: proc.c,v 1.24 2024/04/08 12:48:26 tobhe Exp $ */
+/* $OpenBSD: proc.c,v 1.25 2024/04/09 15:48:01 tobhe Exp $ */
/*
* Copyright (c) 2010 - 2016 Reyk Floeter <reyk@openbsd.org>
#include "proc.h"
void proc_exec(struct privsep *, struct privsep_proc *, unsigned int, int,
- int, char **);
+ char **);
void proc_setup(struct privsep *, struct privsep_proc *, unsigned int);
void proc_open(struct privsep *, int, int);
void proc_accept(struct privsep *, int, enum privsep_procid,
void
proc_exec(struct privsep *ps, struct privsep_proc *procs, unsigned int nproc,
- int debug, int argc, char **argv)
+ int argc, char **argv)
{
unsigned int proc, nargc, i, proc_i;
char **nargv;
fatal("%s: fork", __func__);
break;
case 0:
- /* First create a new session */
- if (setsid() == -1)
- fatal("setsid");
-
/* Prepare parent socket. */
if (fd != PROC_PARENT_SOCK_FILENO) {
if (dup2(fd, PROC_PARENT_SOCK_FILENO)
} else if (fcntl(fd, F_SETFD, 0) == -1)
fatal("fcntl");
- /* Daemons detach from terminal. */
- if (!debug && (fd =
- open(_PATH_DEVNULL, O_RDWR, 0)) != -1) {
- (void)dup2(fd, STDIN_FILENO);
- (void)dup2(fd, STDOUT_FILENO);
- (void)dup2(fd, STDERR_FILENO);
- if (fd > 2)
- (void)close(fd);
- }
-
execvp(argv[0], nargv);
fatal("%s: execvp", __func__);
break;
}
/* Engage! */
- proc_exec(ps, procs, nproc, debug, argc, argv);
+ proc_exec(ps, procs, nproc, argc, argv);
return;
}
log_procinit("%s", p->p_title);
- /* Set the process group of the current process */
- setpgid(0, 0);
-
if (p->p_id == PROC_CONTROL && ps->ps_instance == 0) {
if (control_init(ps, &ps->ps_csock) == -1)
fatalx("%s: control_init", __func__);