Change a returned value of -1 (NO_PGID) to (uint)(pid_t)~0u >> 1 (0x7fffffff)
to satisfy the SuSv3/POSIX-2004/etc requirement that "If there is no foreground process group, tcgetpgrp() shall return a value greater than 1 that does not match the process group ID of any existing process group." Should fix PR standards/28493 and zsh.
This commit is contained in:
parent
4b61add729
commit
4eaada98f4
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: tcgetpgrp.c,v 1.8 2003/08/07 16:44:13 agc Exp $ */
|
||||
/* $NetBSD: tcgetpgrp.c,v 1.9 2004/12/01 21:37:15 dsl Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1989, 1993
|
||||
@ -34,7 +34,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)termios.c 8.2 (Berkeley) 2/21/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: tcgetpgrp.c,v 1.8 2003/08/07 16:44:13 agc Exp $");
|
||||
__RCSID("$NetBSD: tcgetpgrp.c,v 1.9 2004/12/01 21:37:15 dsl Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
@ -62,5 +62,8 @@ tcgetpgrp(fd)
|
||||
if (ioctl(fd, TIOCGPGRP, &s) < 0)
|
||||
return ((pid_t)-1);
|
||||
|
||||
if (s == (pid_t)-1)
|
||||
/* SVID requires a number > 1 that isn't a valid PGID... */
|
||||
s = (uint)(pid_t)~0u >> 1;
|
||||
return ((pid_t)s);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user