src/nnn.c | 8 ++++++++ diff --git a/src/nnn.c b/src/nnn.c index 967363d3c4303edd4f412283378fd86952fd22ea..9ad81ec08b9d1d7ded8f15797a2484ac880265cc 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -863,6 +863,7 @@ return TRUE; } +#ifndef __APPLE__ /* Increase the limit on open file descriptors, if possible */ static rlim_t max_openfds(void) { @@ -888,6 +889,7 @@ limit = 32; return limit; } +#endif /* * Wrapper to realloc() @@ -4905,11 +4907,13 @@ } static blkcnt_t dirwalk(char *path, struct stat *psb) { +#ifndef __APPLE__ static uint_t open_max; /* Increase current open file descriptor limit */ if (!open_max) open_max = max_openfds(); +#endif ent_blocks = 0; tolastln(); @@ -4917,7 +4921,11 @@ addstr(xbasename(path)); addstr(" [^C aborts]\n"); refresh(); +#ifndef __APPLE__ if (nftw(path, nftw_fn, open_max, FTW_MOUNT | FTW_PHYS) < 0) { +#else + if (nftw(path, nftw_fn, OPEN_MAX, FTW_MOUNT | FTW_PHYS) < 0) { +#endif DPRINTF_S("nftw failed"); return cfg.apparentsz ? psb->st_size : psb->st_blocks; }