diff options
author | deischen <deischen@FreeBSD.org> | 2002-08-29 23:06:07 +0000 |
---|---|---|
committer | deischen <deischen@FreeBSD.org> | 2002-08-29 23:06:07 +0000 |
commit | 8347fcb52dac051382b95182fce08ee0fc642340 (patch) | |
tree | 24c4da9130c487d85f113d7fdfa44a22f470cb61 /lib/libpthread/thread/thr_read.c | |
parent | 175524795910e8310c89ecf8adfddb91fc451e9e (diff) | |
download | FreeBSD-src-8347fcb52dac051382b95182fce08ee0fc642340.zip FreeBSD-src-8347fcb52dac051382b95182fce08ee0fc642340.tar.gz |
Remove much of the dereferencing of the fd table entries to look
at file flags and replace it with functions that will avoid null
pointer checks.
MFC to be done by archie ;-)
PR: 42100
Reviewed by: archie, robert
MFC after: 3 days
Diffstat (limited to 'lib/libpthread/thread/thr_read.c')
-rw-r--r-- | lib/libpthread/thread/thr_read.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libpthread/thread/thr_read.c b/lib/libpthread/thread/thr_read.c index 4d81414..067befa 100644 --- a/lib/libpthread/thread/thr_read.c +++ b/lib/libpthread/thread/thr_read.c @@ -57,7 +57,7 @@ _read(int fd, void *buf, size_t nbytes) /* Lock the file descriptor for read: */ if ((ret = _FD_LOCK(fd, FD_READ, NULL)) == 0) { /* Get the read/write mode type: */ - type = _thread_fd_table[fd]->flags & O_ACCMODE; + type = _thread_fd_getflags(fd) & O_ACCMODE; /* Check if the file is not open for read: */ if (type != O_RDONLY && type != O_RDWR) { @@ -69,7 +69,7 @@ _read(int fd, void *buf, size_t nbytes) /* Perform a non-blocking read syscall: */ while ((ret = __sys_read(fd, buf, nbytes)) < 0) { - if ((_thread_fd_table[fd]->flags & O_NONBLOCK) == 0 && + if ((_thread_fd_getflags(fd) & O_NONBLOCK) == 0 && (errno == EWOULDBLOCK || errno == EAGAIN)) { curthread->data.fd.fd = fd; _thread_kern_set_timeout(NULL); |