save and restore errno in select
authorAndrew Tridgell <tridge@samba.org>
Fri, 17 Nov 2000 01:05:50 +0000 (01:05 +0000)
committerAndrew Tridgell <tridge@samba.org>
Fri, 17 Nov 2000 01:05:50 +0000 (01:05 +0000)
(This used to be commit 34f0379096d0701c74a51c51649ffe4cb1a24291)

source3/lib/select.c

index 8a3a6293869f18fd500ecc97496b4b44c05eb4bd..458642f57ec91f3e41bd8ddc17bcab3c35b48f59 100644 (file)
@@ -54,7 +54,7 @@ for file descriptors that were readable
 ********************************************************************/
 int sys_select(int maxfd, fd_set *fds,struct timeval *tval)
 {
-       int ret;
+       int ret, saved_errno;
 
        if (initialised != sys_getpid()) {
                pipe(select_pipe);
@@ -79,11 +79,15 @@ int sys_select(int maxfd, fd_set *fds,struct timeval *tval)
                }
        }
 
+       saved_errno = errno;
+
        while (pipe_written != pipe_read) {
                char c;
                if (read(select_pipe[0], &c, 1) == 1) pipe_read++;
        }
 
+       errno = saved_errno;
+
        return ret;
 }