diff --git a/src/Cldeetr.c b/src/Cldeetr.c index 9366e7df..ceea1cf5 100644 --- a/src/Cldeetr.c +++ b/src/Cldeetr.c @@ -142,7 +142,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); #ifdef DEBUG printf("init_ether: **** Ethernet starts ****\n"); diff --git a/src/chardev.c b/src/chardev.c index 0be3e99f..bf57a6f7 100644 --- a/src/chardev.c +++ b/src/chardev.c @@ -78,7 +78,6 @@ LispPTR CHAR_openfile(LispPTR *args) #ifndef DOS register int fd; /* return value of open system call. */ register int flags; /* open system call's argument */ - register int rval; struct stat statbuf; char pathname[MAXPATHLEN]; @@ -104,9 +103,7 @@ LispPTR CHAR_openfile(LispPTR *args) } /* Prevent I/O requests from blocking -- make them error */ /* if no char is available, or there's no room in pipe. */ - rval = fcntl(fd, F_GETFL, 0); - rval |= FNDELAY; - rval = fcntl(fd, F_SETFL, rval); + fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | FNDELAY); return (GetSmallp(fd)); #endif /* DOS */ diff --git a/src/ether.c b/src/ether.c index 0629ce30..f212f914 100644 --- a/src/ether.c +++ b/src/ether.c @@ -823,7 +823,7 @@ void init_ether() { } 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 { I_Give_Up: diff --git a/src/ldeether.c b/src/ldeether.c index 3e152497..a6c1f7f0 100644 --- a/src/ldeether.c +++ b/src/ldeether.c @@ -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 diff --git a/src/oldeether.c b/src/oldeether.c index b69d3a5f..73fa7fb9 100644 --- a/src/oldeether.c +++ b/src/oldeether.c @@ -140,7 +140,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); #ifdef DEBUG printf("init_ether: **** Ethernet starts ****\n"); diff --git a/src/osmsg.c b/src/osmsg.c index 90108416..1e088010 100644 --- a/src/osmsg.c +++ b/src/osmsg.c @@ -149,7 +149,7 @@ void mess_init() { #ifdef LOGINT LogFileFd = cons_pty; /* was kept as an fd_set, but doesn't need to be */ flags = fcntl(cons_pty, F_GETFL, 0); - flags = fcntl(cons_pty, F_SETFL, (flags | FASYNC | FNDELAY)); + fcntl(cons_pty, F_SETFL, (flags | FASYNC | FNDELAY)); if (fcntl(cons_pty, F_SETOWN, getpid()) == -1) { #ifdef DEBUG perror("fcntl F_SETOWN of log PTY"); diff --git a/src/unixcomm.c b/src/unixcomm.c index 08f58b5e..84a92349 100644 --- a/src/unixcomm.c +++ b/src/unixcomm.c @@ -338,7 +338,7 @@ int FindAvailablePty(char *Master, char *Slave) { flags = fcntl(res, F_GETFL, 0); flags |= FNDELAY; - flags = fcntl(res, F_SETFL, flags); + fcntl(res, F_SETFL, flags); return (res); } #ifndef FULLSLAVENAME @@ -452,8 +452,7 @@ LispPTR Unix_handlecomm(LispPTR *args) { } res = fcntl(PipeFD, F_GETFL, 0); res |= FNDELAY; - res = fcntl(PipeFD, F_SETFL, res); - if (res < 0) { + if (fcntl(PipeFD, F_SETFL, res) == -1) { perror("setting up fifo to nodelay"); return (NIL); } @@ -615,7 +614,7 @@ LispPTR Unix_handlecomm(LispPTR *args) { case 11: /* Fork PTY process */ { char MasterFD[20], SlavePTY[32]; - int Master, res, slot; + int Master, flags, slot; unsigned short len; Master = FindAvailablePty(MasterFD, SlavePTY); @@ -651,9 +650,9 @@ LispPTR Unix_handlecomm(LispPTR *args) { DBPRINT(("Pipe/fork result = %d.\n", d[3])); if (d[3] == 1) { /* Set up the IO not to block */ - res = fcntl(Master, F_GETFL, 0); - res |= FNDELAY; - res = fcntl(Master, F_SETFL, res); + flags = fcntl(Master, F_GETFL, 0); + flags |= FNDELAY; + fcntl(Master, F_SETFL, flags); UJ[slot].type = UJSHELL; /* so we can find them */ UJ[slot].PID = (d[1] << 8) | d[2]; @@ -833,7 +832,7 @@ LispPTR Unix_handlecomm(LispPTR *args) { case 12: /* create Unix socket */ { - int res, sockFD; + int flags, sockFD; struct sockaddr_un sock; /* First open the socket */ @@ -862,9 +861,9 @@ LispPTR Unix_handlecomm(LispPTR *args) { DBPRINT(("Socket %d bound to name %s.\n", sockFD, shcom)); if (listen(sockFD, 1) < 0) perror("Listen"); /* Set up the IO not to block */ - res = fcntl(sockFD, F_GETFL, 0); - res |= FNDELAY; - res = fcntl(sockFD, F_SETFL, res); + flags = fcntl(sockFD, F_GETFL, 0); + flags |= FNDELAY; + fcntl(sockFD, F_SETFL, flags); /* things seem sane, fill out the rest of the UJ slot and return */ UJ[sockFD].status = -1; diff --git a/src/unixfork.c b/src/unixfork.c index a08c996b..2a7598ca 100644 --- a/src/unixfork.c +++ b/src/unixfork.c @@ -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;