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:
@@ -853,9 +853,9 @@ status_t
|
||||
Volume::_AddInitialPackagesFromDirectory()
|
||||
{
|
||||
// iterate through the dir and create packages
|
||||
int fd = dup(fPackagesDirectory->DirectoryFD());
|
||||
int fd = openat(fPackagesDirectory->DirectoryFD(), ".", O_RDONLY);
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user