summaryrefslogtreecommitdiffstats
path: root/src/resolve/resolved-etc-hosts.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2024-03-12 10:23:34 +0100
committerLennart Poettering <lennart@poettering.net>2024-03-12 10:25:48 +0100
commit1c248d7fb725d63a968181901e235e325413f706 (patch)
treebf2d578c62ef4d2cb15309b34d5d44e47057ccb9 /src/resolve/resolved-etc-hosts.c
parentMerge pull request #31671 from AdrianVovk/homework-cifs-credentials (diff)
downloadsystemd-1c248d7fb725d63a968181901e235e325413f706.tar.xz
systemd-1c248d7fb725d63a968181901e235e325413f706.zip
stat-util: add explicit helpers for checking if stat/statx is initialized
This is a follow-up for 945a8210c770801c8492eda03b6e9af3ec5d03a3 and makes the st_dev check generic, so that we can reuse it some other places. It also incorporates the non-NULL check now, to be a comprehensive one-stop solution. The helper is static inline so that compilers can optimize the redundant checks away in case it is combined with other checks.
Diffstat (limited to '')
-rw-r--r--src/resolve/resolved-etc-hosts.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/resolve/resolved-etc-hosts.c b/src/resolve/resolved-etc-hosts.c
index 2d334d38dd..7b05386213 100644
--- a/src/resolve/resolved-etc-hosts.c
+++ b/src/resolve/resolved-etc-hosts.c
@@ -342,7 +342,7 @@ static int manager_etc_hosts_read(Manager *m) {
m->etc_hosts_last = ts;
- if (m->etc_hosts_stat.st_mode != 0) {
+ if (stat_is_set(&m->etc_hosts_stat)) {
if (stat("/etc/hosts", &st) < 0) {
if (errno != ENOENT)
return log_error_errno(errno, "Failed to stat /etc/hosts: %m");