libyal / libewf

Libewf is a library to access the Expert Witness Compression Format (EWF)
GNU Lesser General Public License v3.0
263 stars 76 forks source link

getrlimit max open file descriptors checking code is never used due to missing autoconf check #191

Open svdb0 opened 12 months ago

svdb0 commented 12 months ago

I noticed that some of the ewftools tools have code to check for the maximum number of open file descriptors.
These checks are within #if defined( HAVE_GETRLIMIT ) blocks.
There is however currently no autoconf code which actually checks for getrlimit() and sets HAVE_GETRLIMIT.
Also, the code which includes sys/resource.h, which is needed for getrlimit(), is contained within a #if defined( HAVE_SYS_RESOURCE_H ) block, and there is no autoconf code which checks for the presence of sys/resource.h and sets HAVE_SYS_RESOURCE_H.

Looking through the git history, I see that at one point there were such checks in configure.ac, so I can imagine that this was disabled on purpose for some reason. On the other hand, they might just have fallen between the cracks during a past refactoring.

I have not followed the code all the way through to see how the results of these getrlimit() checks, which are passed through multiple abstraction layers to be stored for later use, are ultimately used.
These checks stood out to me though because I have encountered the situation in the past that a collection of EWF files could not be mounted because the maximum number of open file descriptors was too small, without a helpful error message.

joachimmetz commented 12 months ago

Thanks for flagging, I'll have a look when time permits.