I also noticed that these uses too setpgrp:

binutils/gdb
sendmail
perl

But these are imported so changing may make maintenance harder.


However, these uses setpgrp:

/usr.bin/sudo/logging.c
/usr.sbin/amd/amd/amd.c:
/usr.sbin/mrouted/main.c

..but looks like compiler skips it so it may be better to look these better
so there may be
possibility to remove #ifdef #endif

Here is better diff:

This changes only code that should fix setpgrp->setpgid. That "proc.c"
looks similar in many files, so there may be possibility to do some
refactoring.


Index: sbin/iked/proc.c
===================================================================
RCS file: /OpenBSD/src/sbin/iked/proc.c,v
retrieving revision 1.19
diff -u -p -u -p -r1.19 proc.c
--- sbin/iked/proc.c    18 Aug 2014 09:43:02 -0000      1.19
+++ sbin/iked/proc.c    18 Sep 2014 21:24:11 -0000
@@ -352,7 +352,7 @@ proc_run(struct privsep *ps, struct priv
                fatal("proc_run: cannot fork");
        case 0:
                /* Set the process group of the current process */
-               setpgrp(0, getpid());
+               setpgid(0, getpid());
                break;
        default:
                return (pid);
Index: usr.sbin/lpr/lpd/printjob.c
===================================================================
RCS file: /OpenBSD/src/usr.sbin/lpr/lpd/printjob.c,v
retrieving revision 1.52
diff -u -p -u -p -r1.52 printjob.c
--- usr.sbin/lpr/lpd/printjob.c 7 Feb 2014 23:06:21 -0000       1.52
+++ usr.sbin/lpr/lpd/printjob.c 18 Sep 2014 21:24:19 -0000
@@ -153,7 +153,7 @@ printjob(void)
                (void)close(fd);
        }
        pid = getpid();                         /* for use with lprm */
-       setpgrp(0, pid);
+       setpgid(0, pid);
        /* we add SIGINT to the mask so abortpr() doesn't kill itself */
        memset(&sa, 0, sizeof(sa));
Index: usr.sbin/rarpd/rarpd.c
===================================================================
RCS file: /OpenBSD/src/usr.sbin/rarpd/rarpd.c,v
retrieving revision 1.53
diff -u -p -u -p -r1.53 rarpd.c
--- usr.sbin/rarpd/rarpd.c      6 Apr 2012 18:03:52 -0000       1.53
+++ usr.sbin/rarpd/rarpd.c      18 Sep 2014 21:24:19 -0000
@@ -170,7 +170,7 @@ main(int argc, char *argv[])
                        (void) close(f);
                }
                (void) chdir("/");
-               (void) setpgrp(0, getpid());
+               (void) setpgid(0, getpid());
                devnull = open(_PATH_DEVNULL, O_RDWR);
                if (devnull >= 0) {
                        (void) dup2(devnull, STDIN_FILENO);
Index: usr.sbin/relayd/proc.c
===================================================================
RCS file: /OpenBSD/src/usr.sbin/relayd/proc.c,v
retrieving revision 1.16
diff -u -p -u -p -r1.16 proc.c
--- usr.sbin/relayd/proc.c      18 Aug 2014 12:59:00 -0000      1.16
+++ usr.sbin/relayd/proc.c      18 Sep 2014 21:24:19 -0000
@@ -354,7 +354,7 @@ proc_run(struct privsep *ps, struct priv
                fatal("proc_run: cannot fork");
        case 0:
                /* Set the process group of the current process */
-               setpgrp(0, getpid());
+               setpgid(0, getpid());
                break;
        default:
                return (pid);
Index: usr.sbin/snmpd/proc.c
===================================================================
RCS file: /OpenBSD/src/usr.sbin/snmpd/proc.c,v
retrieving revision 1.11
diff -u -p -u -p -r1.11 proc.c
--- usr.sbin/snmpd/proc.c       18 Aug 2014 13:13:42 -0000      1.11
+++ usr.sbin/snmpd/proc.c       18 Sep 2014 21:24:20 -0000
@@ -352,7 +352,7 @@ proc_run(struct privsep *ps, struct priv
                fatal("proc_run: cannot fork");
        case 0:
                /* Set the process group of the current process */
-               setpgrp(0, getpid());
+               setpgid(0, getpid());
                break;
        default:
                return (pid);

Reply via email to