version 1.5, 2000/09/07 20:27:55 |
version 1.6, 2000/10/27 07:32:19 |
|
|
set_nonblock(int fd) |
set_nonblock(int fd) |
{ |
{ |
int val; |
int val; |
if (isatty(fd)) { |
|
/* do not mess with tty's */ |
|
debug("no set_nonblock for tty fd %d", fd); |
|
return; |
|
} |
|
val = fcntl(fd, F_GETFL, 0); |
val = fcntl(fd, F_GETFL, 0); |
if (val < 0) { |
if (val < 0) { |
error("fcntl(%d, F_GETFL, 0): %s", fd, strerror(errno)); |
error("fcntl(%d, F_GETFL, 0): %s", fd, strerror(errno)); |
return; |
return; |
} |
} |
if (val & O_NONBLOCK) |
if (val & O_NONBLOCK) { |
|
debug("fd %d IS O_NONBLOCK", fd); |
return; |
return; |
|
} |
debug("fd %d setting O_NONBLOCK", fd); |
debug("fd %d setting O_NONBLOCK", fd); |
val |= O_NONBLOCK; |
val |= O_NONBLOCK; |
if (fcntl(fd, F_SETFL, val) == -1) |
if (fcntl(fd, F_SETFL, val) == -1) |