etc/services - sync with NetBSD-8
[minix.git] / minix / lib / libc / sys / m_closefrom.c
blob14db9f80fcbfd9e905b7fe2dcf66cbc779058873
1 #include <sys/cdefs.h>
2 #include "namespace.h"
3 #include <lib.h>
4 #include <stdlib.h>
5 #include <unistd.h>
7 int closefrom(int fd)
9 int f, ok = 0, e = 0;
10 for(f = fd; f < OPEN_MAX; f++) {
11 if(close(f) >= 0)
12 ok = 1;
13 else
14 e = errno;
17 if(ok)
18 return 0;
20 /* all failed - return last valid error */
21 errno = e;
22 return -1;