Re: linux bug in pclose

Matthias Urlichs (smurf@smurf.noris.de)
Sun, 14 Jul 1996 12:06:49 +0100


In linux.dev.kernel, article <199607130642.IAA17936@wn1.sci.kun.nl>,
Michiel Boland <boland@sci.kun.nl> writes:
>=20
> So, to fix your program, you should check inside the SIGCHLD
> handler *what* child has exited, and realize that wait() may
> return -1 when someone else already waited for the child.
>=20
Note also that if you know which process you want to wait for, you shou=
ld
use waitpid() or wait4() instead of wait().

Note also that _any_ process can in fact have extra children it doesn't
know about. This happens if a process calls fork() and then the father
exec()s your program instead of the child.

--=20
Attendants at a service station in Eunice, Louisiana, handed more than
$100 to a naked man who claimed to have a gun in his pocket.
--=20
Matthias Urlichs \ noris network GmbH / Xlink-POP N=FCrnberg=
=20
Schleiermacherstra=DFe 12 \ Linux+Internet / EMail: urlichs@nor=
is.de
90491 N=FCrnberg (Germany) \ Consulting+Programming+Networking+etc=
'ing
PGP: 1024/4F578875 1B 89 E2 1C 43 EA 80 44 15 D2 29 CF C6 C7 E0 D=
E
Click <A HREF=3D"http://info.noris.de/~smurf/finger">here</A>. =
42