diff options
| author | tgoodwin <tgoodwin> | 1998-10-29 14:15:41 +0000 |
|---|---|---|
| committer | Toby Goodwin <toby@paccrat.org> | 2015-05-16 21:23:12 +0100 |
| commit | 709cabfe384362577d53b36817c70001fe9895af (patch) | |
| tree | 2264548edc38970df8b2c7ec3826ce5c78e23185 | |
| parent | 9abdba3fd5946e4af117a297957fdbf11504f801 (diff) | |
Portability: work around readline's broken treatment of a non-blocking
input file descriptor.
| -rw-r--r-- | open.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -24,10 +24,10 @@ extern int rc_open(const char *name, redirtype m) { return open(name, mode_masks[m], 0666); } -/* make a file descriptor non blocking. must only be called after read() -has returned EAGAIN. */ +/* make a file descriptor blocking. return value indicates whether +the desciptor was previously set to non-blocking. */ -extern void makeblocking(int fd) { +extern bool makeblocking(int fd) { int flags; if ((flags = fcntl(fd, F_GETFL)) == -1) { @@ -35,10 +35,11 @@ extern void makeblocking(int fd) { rc_error(NULL); } if (! (flags & O_NONBLOCK)) - panic("not O_NONBLOCK"); + return FALSE; flags &= ~O_NONBLOCK; if (fcntl(fd, F_SETFL, (long) flags) == -1) { uerror("fcntl"); rc_error(NULL); } + return TRUE; } |