Article View: net.bugs.v7
Article #112popen/pclose bugs
From: utzoohenry
Date: Thu, 13 Jan 1983 20:45
Date: Thu, 13 Jan 1983 20:45
18 lines
933 bytes
933 bytes
As came up in connection with a recent Notesfiles failure, popen(3) as
it comes with V7 (etc) has a bug: it does not close the pipe descriptors
if the fork fails. The fix (first pointed out by Berry Kercheval of
Zehntel) is to change the code at about line 28 from:
if(pid == -1)
return NULL;
to
if (pid == -1) {
close(myside);
close(hisside);
return NULL;
}
There is a further bug which I came across in the course of looking at
popen and pclose. Since there is no way to wait(2) selectively for a
specific process, the return code from pclose is unreliable in the
event of multiple simultaneous popen's or other child processes.
Technical Details
Message-ID:
<bnews.utzoo.2747>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
From: utzoo!henry Newsgroups: net.bugs.v7 Title: popen/pclose bugs Article-I.D.: utzoo.2747 Posted: Thu Jan 13 20:45:34 1983 Received: Thu Jan 13 20:45:34 1983 Subject: popen/pclose bugs Date: Thu, 13 Jan 1983 20:45:34 +0000 Message-ID: <bnews.utzoo.2747>