mirror of
https://github.com/Interlisp/maiko.git
synced 2026-01-31 22:02:33 +00:00
fcntl(..., F_SETFL, ...) return value only signals error. (#141)
The return value of `fcntl` when passed `F_SETFL` isn't guaranteed to return the flags passed in as its return value. It will be `-1` in the event of an error, but no other value is to be relied upon. Fortunately, we weren't relying upon the value apart from occasionally checking for an error. This is as it is specified in https://pubs.opengroup.org/onlinepubs/7908799/xsh/fcntl.html Closes interlisp/medley#87.
This commit is contained in:
@@ -225,7 +225,7 @@ of the packet received except:
|
||||
int fork_Unix() {
|
||||
int LispToUnix[2], /* Incoming pipe from LISP */
|
||||
UnixToLisp[2], /* Outgoing pipe to LISP */
|
||||
UnixPID, LispPipeIn, LispPipeOut, res, slot;
|
||||
UnixPID, LispPipeIn, LispPipeOut, flags, slot;
|
||||
pid_t pid;
|
||||
|
||||
char IOBuf[4];
|
||||
@@ -292,9 +292,9 @@ int fork_Unix() {
|
||||
close(LispToUnix[1]);
|
||||
close(UnixToLisp[0]);
|
||||
|
||||
res = fcntl(LispPipeIn, F_GETFL, 0);
|
||||
res &= (65535 - FNDELAY);
|
||||
res = fcntl(LispPipeIn, F_SETFL, res);
|
||||
flags = fcntl(LispPipeIn, F_GETFL, 0);
|
||||
flags &= (65535 - FNDELAY);
|
||||
fcntl(LispPipeIn, F_SETFL, flags);
|
||||
|
||||
while (1) {
|
||||
ssize_t len;
|
||||
|
||||
Reference in New Issue
Block a user