Subject: Re: Perl question, re: POSIX setpgrp
On Fri, 14 Feb 1997 16:31:53 GMT, Chris Vo <chrisv@on.bell.ca> said:
>
>>> POSIX setpgrp can't take an argument at ./check_ntp line 21.
>
> where line 21 reads as:
> setpgrp (0, $$);
Replace that with just
setpgrp;
This does the same thing and will work on all systems.
I think there's a bug here. Perl is expecting a pgrp arg of 0 to mean
$$, but it doesn't allow an explicit $$. Even this seems a little odd,
as on neither system I've got available at the moment is it mentioned
that a 0 pgrp means getpid() (they both mention that a 0 pid means
getpid(), though).
p5p-msgid: <pzraigyshr.fsf@eeyore.ibcinc.com>
#ifdef BSD_GETPGRP
value = (I32)BSD_GETPGRP(pid);
#else
- if (pid != 0)
+ if (pid != 0 && pid != getpid()) {
DIE("POSIX getpgrp can't take an argument");
value = (I32)getpgrp();
#endif
#ifdef BSD_SETPGRP
SETi( BSD_SETPGRP(pid, pgrp) >= 0 );
#else
- if ((pgrp != 0) || (pid != 0)) {
+ if ((pgrp != 0 && pgrp != getpid())) || (pid != 0 && pid != getpid())) {
DIE("POSIX setpgrp can't take an argument");
}
SETi( setpgrp() >= 0 );