ad9df9a490
reduces differences, raise NAME_MAX Change-Id: I2e5f6296e6539162c52fdf13fb1fd27a56587e0c
23 lines
332 B
C
23 lines
332 B
C
#include <sys/cdefs.h>
|
|
#include "namespace.h"
|
|
#include <lib.h>
|
|
#include <stdlib.h>
|
|
#include <unistd.h>
|
|
|
|
int closefrom(int fd)
|
|
{
|
|
int f, ok = 0, e = 0;
|
|
for(f = fd; f < OPEN_MAX; f++) {
|
|
if(close(f) >= 0)
|
|
ok = 1;
|
|
else
|
|
e = errno;
|
|
}
|
|
|
|
if(ok)
|
|
return 0;
|
|
|
|
/* all failed - return last valid error */
|
|
errno = e;
|
|
return -1;
|
|
}
|