]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sysusers: use filename if /proc is not mounted
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 30 Dec 2021 15:11:01 +0000 (00:11 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 30 Dec 2021 18:11:43 +0000 (03:11 +0900)
During system install, /proc may not be mounted yet.

Fixes RHBZ#2036217 (https://bugzilla.redhat.com/show_bug.cgi?id=2036217).

src/sysusers/sysusers.c

index 015e3a9ae401ed7d35b92bffaa5fa8c024f6cca7..07a65a2ebc14086e4e2b4321b61e283f34063af9 100644 (file)
@@ -284,7 +284,7 @@ static int make_backup(const char *target, const char *x) {
 
         /* Copy over the access mask. Don't fail on chmod() or chown(). If it stays owned by us and/or
          * unreadable by others, then it isn't too bad... */
-        r = fchmod_and_chown(fileno(dst), st.st_mode & 07777, st.st_uid, st.st_gid);
+        r = fchmod_and_chown_with_fallback(fileno(dst), dst_tmp, st.st_mode & 07777, st.st_uid, st.st_gid);
         if (r < 0)
                 log_warning_errno(r, "Failed to change access mode or ownership of %s: %m", backup);