]> git.ipfire.org Git - thirdparty/git.git/commit - object-file.c
get_max_fd_limit(): fall back to OPEN_MAX upon getrlimit/sysconf failure
authorJunio C Hamano <gitster@pobox.com>
Wed, 18 Dec 2013 22:59:12 +0000 (14:59 -0800)
committerJunio C Hamano <gitster@pobox.com>
Wed, 18 Dec 2013 22:59:43 +0000 (14:59 -0800)
commit491a8dec44e9b91149ef77c77c341e7d41df39be
tree219e68c2cde0f9ea9f90d9c8357d272559cf145f
parent5512ac5840c8bcaa487806cf402ff960091ab244
get_max_fd_limit(): fall back to OPEN_MAX upon getrlimit/sysconf failure

On broken systems where RLIMIT_NOFILE is visible by the compliers
but underlying getrlimit() system call does not behave, we used to
simply die() when we are trying to decide how many file descriptors
to allocate for keeping packfiles open.  Instead, allow the fallback
codepath to take over when we get such a failure from getrlimit().

The same issue exists with _SC_OPEN_MAX and sysconf(); restructure
the code in a similar way to prepare for a broken sysconf() as well.

Noticed-by: Joey Hess <joey@kitenet.net>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sha1_file.c