packagefs: don't dup() the packages directory FD

Volume::_AddInitialPackagesFromDirectory(): Use openat() instead of
dup() to get a FD for the packages directory. Currently our fdopendir()
implementation doesn't use it directly anyway, but in theory it could
and would then change the state of the original FD.
This commit is contained in:
Ingo Weinhold 2013-04-09 23:35:57 +02:00
parent 19dc1d084f
commit 40cbf171ef
1 changed files with 2 additions and 2 deletions

View File

@ -853,9 +853,9 @@ status_t
Volume::_AddInitialPackagesFromDirectory() Volume::_AddInitialPackagesFromDirectory()
{ {
// iterate through the dir and create packages // iterate through the dir and create packages
int fd = dup(fPackagesDirectory->DirectoryFD()); int fd = openat(fPackagesDirectory->DirectoryFD(), ".", O_RDONLY);
if (fd < 0) { if (fd < 0) {
ERROR("Failed to dup() packages directory FD: %s\n", strerror(errno)); ERROR("Failed to open packages directory: %s\n", strerror(errno));
RETURN_ERROR(errno); RETURN_ERROR(errno);
} }