deletePath(): Return ENFILE instead of EBADF when out of file descriptors
Also remove an erroneous comment.
This commit is contained in:
parent
c5fafca5a4
commit
140ccf1368
|
@ -413,7 +413,7 @@ static void _deletePath(int parentfd, const Path & path, uint64_t & bytesFreed)
|
||||||
}
|
}
|
||||||
|
|
||||||
int fd = openat(parentfd, path.c_str(), O_RDONLY);
|
int fd = openat(parentfd, path.c_str(), O_RDONLY);
|
||||||
if (!fd)
|
if (fd == -1)
|
||||||
throw SysError("opening directory '%1%'", path);
|
throw SysError("opening directory '%1%'", path);
|
||||||
AutoCloseDir dir(fdopendir(fd));
|
AutoCloseDir dir(fdopendir(fd));
|
||||||
if (!dir)
|
if (!dir)
|
||||||
|
@ -437,10 +437,7 @@ static void _deletePath(const Path & path, uint64_t & bytesFreed)
|
||||||
|
|
||||||
AutoCloseFD dirfd(open(dir.c_str(), O_RDONLY));
|
AutoCloseFD dirfd(open(dir.c_str(), O_RDONLY));
|
||||||
if (!dirfd) {
|
if (!dirfd) {
|
||||||
// This really shouldn't fail silently, but it's left this way
|
|
||||||
// for backwards compatibility.
|
|
||||||
if (errno == ENOENT) return;
|
if (errno == ENOENT) return;
|
||||||
|
|
||||||
throw SysError("opening directory '%1%'", path);
|
throw SysError("opening directory '%1%'", path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue