diff options
author | Daan De Meyer <daan.j.demeyer@gmail.com> | 2022-11-21 10:49:37 +0100 |
---|---|---|
committer | Daan De Meyer <daan.j.demeyer@gmail.com> | 2022-11-21 10:49:37 +0100 |
commit | 92b11378ff2e32626df830756d552d8e7e20e4a5 (patch) | |
tree | d00d187054cd8c337bbe5236ba9852c75c5cb3ab /src | |
parent | mkfs-util: Use GID_FMT (diff) | |
download | systemd-92b11378ff2e32626df830756d552d8e7e20e4a5.tar.xz systemd-92b11378ff2e32626df830756d552d8e7e20e4a5.zip |
mkfs-util: Prefer fd based stat() where possible
Diffstat (limited to 'src')
-rw-r--r-- | src/shared/mkfs-util.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/shared/mkfs-util.c b/src/shared/mkfs-util.c index 0f4d85b58c..b06ba32089 100644 --- a/src/shared/mkfs-util.c +++ b/src/shared/mkfs-util.c @@ -165,7 +165,7 @@ static int do_mcopy(const char *node, const char *root) { if (r < 0) return log_oom(); - if (stat(root, &st) < 0) + if (fstat(dirfd(rootdir), &st) < 0) return log_error_errno(errno, "Failed to stat '%s': %m", root); r = safe_fork("(mcopy)", FORK_RESET_SIGNALS|FORK_RLIMIT_NOFILE_SAFE|FORK_DEATHSIG|FORK_LOG|FORK_WAIT|FORK_STDOUT_TO_STDERR|FORK_NEW_USERNS, NULL); |