mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-07 17:17:44 +03:00
fd-util: close_all() check d_type
Tiny optimization: check dirent's d_type before trying to parse /proc/self/fd/ filenames, given we have that anyway.
This commit is contained in:
parent
c844f0a924
commit
1f6639eac7
@ -353,6 +353,9 @@ int close_all_fds(const int except[], size_t n_except) {
|
||||
FOREACH_DIRENT(de, d, return -errno) {
|
||||
int fd = -1, q;
|
||||
|
||||
if (!IN_SET(de->d_type, DT_LNK, DT_UNKNOWN))
|
||||
continue;
|
||||
|
||||
if (safe_atoi(de->d_name, &fd) < 0)
|
||||
/* Let's better ignore this, just in case */
|
||||
continue;
|
||||
|
Loading…
Reference in New Issue
Block a user