diff --git a/cmd/zed/zed_file.c b/cmd/zed/zed_file.c index 6b6a56759..2212022ef 100644 --- a/cmd/zed/zed_file.c +++ b/cmd/zed/zed_file.c @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include @@ -175,9 +174,7 @@ zed_file_is_locked(int fd) void zed_file_close_from(int lowfd) { - static const int maxfd_def = 256; int errno_bak = errno; - struct rlimit rl; int maxfd = 0; int fd; DIR *fddir; @@ -190,11 +187,8 @@ zed_file_close_from(int lowfd) maxfd = fd; } (void) closedir(fddir); - } else if (getrlimit(RLIMIT_NOFILE, &rl) < 0 || - rl.rlim_max == RLIM_INFINITY) { - maxfd = maxfd_def; } else { - maxfd = rl.rlim_max; + maxfd = sysconf(_SC_OPEN_MAX); } for (fd = lowfd; fd < maxfd; fd++) (void) close(fd);