mirror of
https://github.com/Interlisp/maiko.git
synced 2026-01-25 19:46:21 +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:
@@ -130,7 +130,7 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
|
||||
flags = fcntl(ether_fd, F_GETFL, 0);
|
||||
flags = fcntl(ether_fd, F_SETFL, flags | O_NDELAY);
|
||||
fcntl(ether_fd, F_SETFL, flags | O_NDELAY);
|
||||
|
||||
#else
|
||||
/* N O T D L P I C O D E */
|
||||
@@ -211,7 +211,7 @@ int main(int argc, char *argv[]) {
|
||||
strcpy(Ename, if_data.ifc_req[0].ifr_name);
|
||||
|
||||
flags = fcntl(ether_fd, F_GETFL, 0);
|
||||
flags = fcntl(ether_fd, F_SETFL, flags | FASYNC | FNDELAY);
|
||||
fcntl(ether_fd, F_SETFL, flags | FASYNC | FNDELAY);
|
||||
|
||||
#endif /* USE_DLPI */
|
||||
#ifdef DEBUG
|
||||
|
||||
Reference in New Issue
Block a user