Fix usage of readdir_r()
authorLucas De Marchi <lucas.demarchi@intel.com>
Wed, 28 Aug 2013 02:29:47 +0000 (23:29 -0300)
committerLucas De Marchi <lucas.demarchi@intel.com>
Thu, 29 Aug 2013 04:33:51 +0000 (01:33 -0300)
commit7e0385c47ae7c313a59de3ea431af7b5d18807d7
tree88653cafaf974851937d6edccc843bb4d284d177
parentbd4e7340bcd9f95e04a6309667ffe1a5427edcaa
Fix usage of readdir_r()

With readdir_r() we should be providing enough space to store the dir
name. This could be accomplished by define an union like systemd does:

union dirent_storage {
struct dirent de;
uint8_t storage[offsetof(struct dirent, d_name) +
((NAME_MAX + 1 + sizeof(long)) & ~(sizeof(long) - 1))];
};

However in all places that we use readdir_r() we have no concerns about
reentrance nor we have problems with threads. Thus use the simpler
readdir() instead.

We also remove the error logging here (that could be added back by
checking errno), but it was not adding much value so it's gone.
libkmod/libkmod-config.c
libkmod/libkmod-module.c
tools/depmod.c