avoid fd leak if opendir is cancelled when calloc has failed
[musl] / lib /
2011-02-17 Rich Felkernew solution for empty lib dir (old one had some problems)