🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by utzoohenry Thu, 13 Jan 1983 20:45
popen/pclose bugs
#112
Author: utzoohenry
Date: Thu, 13 Jan 1983 20:45
18 lines
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.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads