resolved: use unlinkat() where appropriate

This commit is contained in:
Lennart Poettering
2024-09-11 21:34:51 +02:00
committed by Daan De Meyer
parent aaa6c6e279
commit 368051ee6b
+2 -8
View File
@@ -1726,7 +1726,6 @@ void manager_cleanup_saved_user(Manager *m) {
}
FOREACH_DIRENT_ALL(de, d, log_error_errno(errno, "Failed to read interface directory: %m")) {
_cleanup_free_ char *p = NULL;
int ifindex;
Link *l;
@@ -1750,13 +1749,8 @@ void manager_cleanup_saved_user(Manager *m) {
continue;
rm:
p = path_join("/run/systemd/resolve/netif", de->d_name);
if (!p) {
log_oom();
return;
}
(void) unlink(p);
if (unlinkat(dirfd(d), de->d_name, 0) < 0)
log_warning_errno(errno, "Failed to remove left-over interface configuration file '%s', ignoring: %m", de->d_name);
}
}