diff options
author | dt <dt@FreeBSD.org> | 1998-09-13 15:33:42 +0000 |
---|---|---|
committer | dt <dt@FreeBSD.org> | 1998-09-13 15:33:42 +0000 |
commit | fd32b02341cde758f6f6f632f9c7ddd120241f8f (patch) | |
tree | c488eae3fdf6f6bbc79f735c13165355e509cb7a /lib/libc_r | |
parent | c972cf2a023cbbef488f40a5953c085b9a038298 (diff) | |
download | FreeBSD-src-fd32b02341cde758f6f6f632f9c7ddd120241f8f.zip FreeBSD-src-fd32b02341cde758f6f6f632f9c7ddd120241f8f.tar.gz |
Don't clobber errno if we are not going to fail.
Diffstat (limited to 'lib/libc_r')
-rw-r--r-- | lib/libc_r/uthread/uthread_fd.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/libc_r/uthread/uthread_fd.c b/lib/libc_r/uthread/uthread_fd.c index 814fc7b..fa8b88b 100644 --- a/lib/libc_r/uthread/uthread_fd.c +++ b/lib/libc_r/uthread/uthread_fd.c @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: uthread_fd.c,v 1.7 1998/05/27 00:41:22 jb Exp $ + * $Id: uthread_fd.c,v 1.8 1998/06/09 23:16:53 jb Exp $ * */ #include <errno.h> @@ -55,6 +55,7 @@ _thread_fd_table_init(int fd) { int ret = 0; struct fd_table_entry *entry; + int saved_errno; /* Check if the file descriptor is out of range: */ if (fd < 0 || fd >= _thread_dtablesize) { @@ -116,8 +117,10 @@ _thread_fd_table_init(int fd) * not support non-blocking calls, or if the * driver is naturally non-blocking. */ + saved_errno = errno; _thread_sys_fcntl(fd, F_SETFL, entry->flags | O_NONBLOCK); + errno = saved_errno; /* Lock the file descriptor table: */ _SPINLOCK(&fd_table_lock); |