tree-wide: replace all readdir cycles with FOREACH_DIRENT{,_ALL} (#4853)
This commit is contained in:
committed by
Martin Pitt
parent
9258a1cae3
commit
8fb3f00997
+2
-4
@@ -24,6 +24,7 @@
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "dirent-util.h"
|
||||
#include "fd-util.h"
|
||||
#include "fs-util.h"
|
||||
#include "macro.h"
|
||||
@@ -234,12 +235,9 @@ int close_all_fds(const int except[], unsigned n_except) {
|
||||
return r;
|
||||
}
|
||||
|
||||
while ((de = readdir(d))) {
|
||||
FOREACH_DIRENT(de, d, return -errno) {
|
||||
int fd = -1;
|
||||
|
||||
if (hidden_or_backup_file(de->d_name))
|
||||
continue;
|
||||
|
||||
if (safe_atoi(de->d_name, &fd) < 0)
|
||||
/* Let's better ignore this, just in case */
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user