=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/ssh/misc.c,v retrieving revision 1.21.2.2 retrieving revision 1.22 diff -u -r1.21.2.2 -r1.22 --- src/usr.bin/ssh/misc.c 2004/08/19 22:37:31 1.21.2.2 +++ src/usr.bin/ssh/misc.c 2003/09/18 08:49:45 1.22 @@ -23,7 +23,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: misc.c,v 1.21.2.2 2004/08/19 22:37:31 brad Exp $"); +RCSID("$OpenBSD: misc.c,v 1.22 2003/09/18 08:49:45 markus Exp $"); #include "misc.h" #include "log.h" @@ -46,7 +46,7 @@ } /* set/unset filedescriptor to non-blocking */ -int +void set_nonblock(int fd) { int val; @@ -54,23 +54,20 @@ val = fcntl(fd, F_GETFL, 0); if (val < 0) { error("fcntl(%d, F_GETFL, 0): %s", fd, strerror(errno)); - return (-1); + return; } if (val & O_NONBLOCK) { - debug3("fd %d is O_NONBLOCK", fd); - return (0); + debug2("fd %d is O_NONBLOCK", fd); + return; } debug2("fd %d setting O_NONBLOCK", fd); val |= O_NONBLOCK; - if (fcntl(fd, F_SETFL, val) == -1) { - debug("fcntl(%d, F_SETFL, O_NONBLOCK): %s", fd, - strerror(errno)); - return (-1); - } - return (0); + if (fcntl(fd, F_SETFL, val) == -1) + debug("fcntl(%d, F_SETFL, O_NONBLOCK): %s", + fd, strerror(errno)); } -int +void unset_nonblock(int fd) { int val; @@ -78,20 +75,17 @@ val = fcntl(fd, F_GETFL, 0); if (val < 0) { error("fcntl(%d, F_GETFL, 0): %s", fd, strerror(errno)); - return (-1); + return; } if (!(val & O_NONBLOCK)) { - debug3("fd %d is not O_NONBLOCK", fd); - return (0); + debug2("fd %d is not O_NONBLOCK", fd); + return; } debug("fd %d clearing O_NONBLOCK", fd); val &= ~O_NONBLOCK; - if (fcntl(fd, F_SETFL, val) == -1) { - debug("fcntl(%d, F_SETFL, ~O_NONBLOCK): %s", + if (fcntl(fd, F_SETFL, val) == -1) + debug("fcntl(%d, F_SETFL, O_NONBLOCK): %s", fd, strerror(errno)); - return (-1); - } - return (0); } /* disable nagle on socket */ @@ -103,7 +97,7 @@ optlen = sizeof opt; if (getsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &opt, &optlen) == -1) { - debug("getsockopt TCP_NODELAY: %.100s", strerror(errno)); + error("getsockopt TCP_NODELAY: %.100s", strerror(errno)); return; } if (opt == 1) { @@ -308,7 +302,7 @@ { va_list ap; char buf[1024]; - u_int nalloc; + int nalloc; va_start(ap, fmt); vsnprintf(buf, sizeof(buf), fmt, ap);