summaryrefslogtreecommitdiff
path: root/openbsd-compat/bsd-closefrom.c
diff options
context:
space:
mode:
Diffstat (limited to 'openbsd-compat/bsd-closefrom.c')
-rw-r--r--openbsd-compat/bsd-closefrom.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/openbsd-compat/bsd-closefrom.c b/openbsd-compat/bsd-closefrom.c
index 61a9fa391..5b7b94ae4 100644
--- a/openbsd-compat/bsd-closefrom.c
+++ b/openbsd-compat/bsd-closefrom.c
@@ -46,7 +46,7 @@
46# define OPEN_MAX 256 46# define OPEN_MAX 256
47#endif 47#endif
48 48
49RCSID("$Id: bsd-closefrom.c,v 1.1 2004/08/15 08:41:00 djm Exp $"); 49RCSID("$Id: bsd-closefrom.c,v 1.2 2005/11/10 08:29:13 dtucker Exp $");
50 50
51#ifndef lint 51#ifndef lint
52static const char sudorcsid[] = "$Sudo: closefrom.c,v 1.6 2004/06/01 20:51:56 millert Exp $"; 52static const char sudorcsid[] = "$Sudo: closefrom.c,v 1.6 2004/06/01 20:51:56 millert Exp $";
@@ -67,7 +67,7 @@ closefrom(int lowfd)
67 67
68 /* Check for a /proc/$$/fd directory. */ 68 /* Check for a /proc/$$/fd directory. */
69 len = snprintf(fdpath, sizeof(fdpath), "/proc/%ld/fd", (long)getpid()); 69 len = snprintf(fdpath, sizeof(fdpath), "/proc/%ld/fd", (long)getpid());
70 if (len != -1 && len <= sizeof(fdpath) && (dirp = opendir(fdpath))) { 70 if (len >= 0 && (u_int)len <= sizeof(fdpath) && (dirp = opendir(fdpath))) {
71 while ((dent = readdir(dirp)) != NULL) { 71 while ((dent = readdir(dirp)) != NULL) {
72 fd = strtol(dent->d_name, &endp, 10); 72 fd = strtol(dent->d_name, &endp, 10);
73 if (dent->d_name != endp && *endp == '\0' && 73 if (dent->d_name != endp && *endp == '\0' &&