]> git.saurik.com Git - apple/libc.git/blobdiff - compat-43/FreeBSD/setpgrp.c
Libc-825.24.tar.gz
[apple/libc.git] / compat-43 / FreeBSD / setpgrp.c
index 011f7bc580f4c1a2dadfcc9e8d197f2e4491cd62..ebed79a40b842b1eb0dd70a854c4d2283e508ddf 100644 (file)
@@ -36,8 +36,13 @@ __FBSDID("$FreeBSD: src/lib/libc/compat-43/setpgrp.c,v 1.5 2007/01/09 00:27:49 i
 #include <sys/types.h>
 #include <unistd.h>
 
-int
-setpgrp(pid_t pid, pid_t pgid)
+/* UNIX03 only */
+pid_t
+setpgrp(void)
 {
-       return(setpgid(pid, pgid));
+       pid_t pgid = getpgrp();
+       pid_t pid = getpid();
+       if (pgid != pid)
+           setpgid(pid, pid);
+       return pid;
 }