View | Details | Raw Unified | Return to bug 2862
Collapse All | Expand All

(-)a/openbsd-compat/bsd-closefrom.c (-1 / +1 lines)
Lines 77-83 closefrom(int lowfd) Link Here
77
77
78
    /* Check for a /proc/$$/fd directory. */
78
    /* Check for a /proc/$$/fd directory. */
79
    len = snprintf(fdpath, sizeof(fdpath), "/proc/%ld/fd", (long)getpid());
79
    len = snprintf(fdpath, sizeof(fdpath), "/proc/%ld/fd", (long)getpid());
80
    if (len > 0 && (size_t)len <= sizeof(fdpath) && (dirp = opendir(fdpath))) {
80
    if (len > 0 && (size_t)len < sizeof(fdpath) && (dirp = opendir(fdpath))) {
81
	while ((dent = readdir(dirp)) != NULL) {
81
	while ((dent = readdir(dirp)) != NULL) {
82
	    fd = strtol(dent->d_name, &endp, 10);
82
	    fd = strtol(dent->d_name, &endp, 10);
83
	    if (dent->d_name != endp && *endp == '\0' &&
83
	    if (dent->d_name != endp && *endp == '\0' &&

Return to bug 2862