Skip to content

Commit ebae9ff

Browse files
jrngitster
authored andcommitted
compat: add missing #include <sys/resource.h>
Starting with commit c793430 (Limit file descriptors used by packs, 2011-02-28), git uses getrlimit to tell how many file descriptors it can use. Unfortunately it does not include the header declaring that function, resulting in compilation errors: sha1_file.c: In function 'open_packed_git_1': sha1_file.c:718: error: storage size of 'lim' isn't known sha1_file.c:721: warning: implicit declaration of function 'getrlimit' sha1_file.c:721: error: 'RLIMIT_NOFILE' undeclared (first use in this function) sha1_file.c:718: warning: unused variable 'lim' The standard header to include for this is <sys/resource.h> (which on some systems itself requires declarations from <sys/types.h> or <sys/time.h>). Probably the problem was missed until now because in current glibc sys/resource.h happens to be included by sys/wait.h. MinGW does not provide sys/resource.h (and compat/mingw takes care of providing getrlimit some other way), so add the missing #include to the "#ifndef __MINGW32__" block in git-compat-util.h. Reported-by: Stefan Sperling <[email protected]> Tested-by: Stefan Sperling <[email protected]> [on OpenBSD] Tested-by: Arnaud Lacombe <[email protected]> [on FreeBSD 8] Signed-off-by: Jonathan Nieder <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d83a831 commit ebae9ff

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

git-compat-util.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@
118118
#endif
119119
#ifndef __MINGW32__
120120
#include <sys/wait.h>
121+
#include <sys/resource.h>
121122
#include <sys/socket.h>
122123
#include <sys/ioctl.h>
123124
#include <termios.h>

0 commit comments

Comments
 (0)