From: Ben Gras Date: Wed, 3 Aug 2011 10:51:28 +0000 (+0200) Subject: added missing m_closefrom.c X-Git-Tag: v3.2.0~388 X-Git-Url: http://zhaoyanbai.com/repos/%22/xml/v3/status/static/gitweb.css?a=commitdiff_plain;h=a99a4b2a056bec8e037f4e10252247b6905a8781;p=minix.git added missing m_closefrom.c --- diff --git a/lib/nbsd_libc/sys-minix/m_closefrom.c b/lib/nbsd_libc/sys-minix/m_closefrom.c new file mode 100644 index 000000000..962e84a5b --- /dev/null +++ b/lib/nbsd_libc/sys-minix/m_closefrom.c @@ -0,0 +1,23 @@ +#include +#include "namespace.h" +#include +#include +#include + +PUBLIC int closefrom(int fd) +{ + int f, ok = 0, e; + for(f = fd; f < __MINIX_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; +}