*: convert amenable fdopendir() calls to take_fdopendir()
Some fdopendir() calls remain where safe_close() is manually performed, those could be simplified as well by converting to use the _cleanup_close_ machinery, but makes things less trivial to review so left for a future cleanup.
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include "alloc-util.h"
|
||||
#include "dirent-util.h"
|
||||
#include "fd-util.h"
|
||||
#include "fileio.h"
|
||||
#include "fs-util.h"
|
||||
#include "macro.h"
|
||||
#include "missing_fs.h"
|
||||
@@ -77,10 +78,9 @@ int dir_is_empty_at(int dir_fd, const char *path) {
|
||||
if (fd < 0)
|
||||
return -errno;
|
||||
|
||||
d = fdopendir(fd);
|
||||
d = take_fdopendir(&fd);
|
||||
if (!d)
|
||||
return -errno;
|
||||
fd = -1;
|
||||
|
||||
FOREACH_DIRENT(de, d, return -errno)
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user