From 2fc3edb7a766da12a52bf60b84fbc19b679f6765 Mon Sep 17 00:00:00 2001 From: millert Date: Tue, 16 Dec 2014 03:35:49 +0000 Subject: [PATCH] Replace setpgrp(0, getpid()) with setpgid(0, 0). OK deraadt@ tedu@ --- sbin/iked/proc.c | 4 ++-- usr.sbin/httpd/proc.c | 4 ++-- usr.sbin/lpr/lpd/printjob.c | 6 +++--- usr.sbin/rarpd/rarpd.c | 4 ++-- usr.sbin/relayd/proc.c | 4 ++-- usr.sbin/snmpd/proc.c | 4 ++-- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/sbin/iked/proc.c b/sbin/iked/proc.c index 4356bcc35cd..c64463efa7f 100644 --- a/sbin/iked/proc.c +++ b/sbin/iked/proc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: proc.c,v 1.20 2014/10/25 03:18:13 lteo Exp $ */ +/* $OpenBSD: proc.c,v 1.21 2014/12/16 03:35:49 millert Exp $ */ /* * Copyright (c) 2010 - 2014 Reyk Floeter @@ -351,7 +351,7 @@ proc_run(struct privsep *ps, struct privsep_proc *p, fatal("proc_run: cannot fork"); case 0: /* Set the process group of the current process */ - setpgrp(0, getpid()); + setpgid(0, 0); break; default: return (pid); diff --git a/usr.sbin/httpd/proc.c b/usr.sbin/httpd/proc.c index d0994f89d04..fc3c0e4a8db 100644 --- a/usr.sbin/httpd/proc.c +++ b/usr.sbin/httpd/proc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: proc.c,v 1.5 2014/10/25 03:23:49 lteo Exp $ */ +/* $OpenBSD: proc.c,v 1.6 2014/12/16 03:35:49 millert Exp $ */ /* * Copyright (c) 2010 - 2014 Reyk Floeter @@ -351,7 +351,7 @@ proc_run(struct privsep *ps, struct privsep_proc *p, fatal("proc_run: cannot fork"); case 0: /* Set the process group of the current process */ - setpgrp(0, getpid()); + setpgid(0, 0); break; default: return (pid); diff --git a/usr.sbin/lpr/lpd/printjob.c b/usr.sbin/lpr/lpd/printjob.c index 2bafc0ca2f9..226f299b458 100644 --- a/usr.sbin/lpr/lpd/printjob.c +++ b/usr.sbin/lpr/lpd/printjob.c @@ -1,4 +1,4 @@ -/* $OpenBSD: printjob.c,v 1.52 2014/02/07 23:06:21 millert Exp $ */ +/* $OpenBSD: printjob.c,v 1.53 2014/12/16 03:35:49 millert Exp $ */ /* $NetBSD: printjob.c,v 1.31 2002/01/21 14:42:30 wiz Exp $ */ /* @@ -152,8 +152,7 @@ printjob(void) } (void)close(fd); } - pid = getpid(); /* for use with lprm */ - setpgrp(0, pid); + setpgid(0, 0); /* we add SIGINT to the mask so abortpr() doesn't kill itself */ memset(&sa, 0, sizeof(sa)); @@ -187,6 +186,7 @@ printjob(void) /* * write process id for others to know */ + pid = getpid(); if ((pidoff = i = snprintf(line, sizeof(line), "%d\n", pid)) >= sizeof(line) || pidoff == -1) { syslog(LOG_ERR, "impossibly large pid: %u", pid); diff --git a/usr.sbin/rarpd/rarpd.c b/usr.sbin/rarpd/rarpd.c index 07d86f3628d..98360e0b3c8 100644 --- a/usr.sbin/rarpd/rarpd.c +++ b/usr.sbin/rarpd/rarpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rarpd.c,v 1.56 2014/10/31 20:11:52 deraadt Exp $ */ +/* $OpenBSD: rarpd.c,v 1.57 2014/12/16 03:35:49 millert Exp $ */ /* $NetBSD: rarpd.c,v 1.25 1998/04/23 02:48:33 mrg Exp $ */ /* @@ -171,7 +171,7 @@ main(int argc, char *argv[]) (void) close(f); } (void) chdir("/"); - (void) setpgrp(0, getpid()); + (void) setpgid(0, 0); devnull = open(_PATH_DEVNULL, O_RDWR); if (devnull >= 0) { (void) dup2(devnull, STDIN_FILENO); diff --git a/usr.sbin/relayd/proc.c b/usr.sbin/relayd/proc.c index 49b31b01f7a..f0dfcbba403 100644 --- a/usr.sbin/relayd/proc.c +++ b/usr.sbin/relayd/proc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: proc.c,v 1.17 2014/10/25 03:23:49 lteo Exp $ */ +/* $OpenBSD: proc.c,v 1.18 2014/12/16 03:35:49 millert Exp $ */ /* * Copyright (c) 2010 - 2014 Reyk Floeter @@ -353,7 +353,7 @@ proc_run(struct privsep *ps, struct privsep_proc *p, fatal("proc_run: cannot fork"); case 0: /* Set the process group of the current process */ - setpgrp(0, getpid()); + setpgid(0, 0); break; default: return (pid); diff --git a/usr.sbin/snmpd/proc.c b/usr.sbin/snmpd/proc.c index 30c4e0d47a8..07910b24474 100644 --- a/usr.sbin/snmpd/proc.c +++ b/usr.sbin/snmpd/proc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: proc.c,v 1.12 2014/10/25 03:23:49 lteo Exp $ */ +/* $OpenBSD: proc.c,v 1.13 2014/12/16 03:35:49 millert Exp $ */ /* * Copyright (c) 2010 - 2014 Reyk Floeter @@ -351,7 +351,7 @@ proc_run(struct privsep *ps, struct privsep_proc *p, fatal("proc_run: cannot fork"); case 0: /* Set the process group of the current process */ - setpgrp(0, getpid()); + setpgid(0, 0); break; default: return (pid); -- 2.20.1