From 9f096becc4b9a49051eceb6c94a3c088c519c04d Mon Sep 17 00:00:00 2001 From: Mark Salter Date: Thu, 26 Apr 2012 10:14:01 -0400 Subject: getpgrp: fix fallback handling The test for generating a stub for getpgrp was wrong and would result in duplicate symbols when building without __NR_getpgrp, but with __NR_getpgid and __NR_getpid. A closer look at the getpgrp implementation using getpgid showed that getpid was being called to pass the current pid to getpgid. This is unnecessary because passing 0 to getpgid returns the pgid of the current process. This patch cleans up the getpgrp implementation and the stub test. Signed-off-by: Mark Salter Signed-off-by: Mike Frysinger --- libc/sysdeps/linux/common/getpgrp.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'libc/sysdeps/linux/common/getpgrp.c') diff --git a/libc/sysdeps/linux/common/getpgrp.c b/libc/sysdeps/linux/common/getpgrp.c index 0af9dc499..14912c376 100644 --- a/libc/sysdeps/linux/common/getpgrp.c +++ b/libc/sysdeps/linux/common/getpgrp.c @@ -13,10 +13,9 @@ #ifdef __NR_getpgrp /* According to the manpage the POSIX.1 version is favoured */ _syscall_noerr0(pid_t, getpgrp) -#elif defined __NR_getpgid && (defined __NR_getpid || defined __NR_getxpid) -/* IA64 doesn't have a getpgrp syscall */ +#elif defined __NR_getpgid pid_t getpgrp(void) { - return getpgid(getpid()); + return getpgid(0); } #endif -- cgit v1.2.3