diff options
author | Kairui Song <kasong@redhat.com> | 2021-01-14 00:39:10 +0800 |
---|---|---|
committer | The Plumber <50238977+systemd-rhel-bot@users.noreply.github.com> | 2021-06-22 14:26:08 +0200 |
commit | 3299c855c6e65596ff9d8635dcbd45ff6818499a (patch) | |
tree | aacda1671413a92ffbcda8b2ab4705b8125fe651 | |
parent | 99ca5b681fceedd010b2616b1248a483f4bfbd97 (diff) | |
download | systemd-3299c855c6e65596ff9d8635dcbd45ff6818499a.tar.gz |
initrd: do a debug log if failed to detect rootfs type
(cherry picked from commit 3377c740d9121f38385e70d6a380b5e4bd8c672a)
Related: #1959339
-rw-r--r-- | src/basic/util.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/basic/util.c b/src/basic/util.c index 59bcf7b00c..fef52ad5ff 100644 --- a/src/basic/util.c +++ b/src/basic/util.c @@ -166,8 +166,16 @@ bool in_initrd(void) { } } - saved_in_initrd = (lenient || path_is_temporary_fs("/") > 0) && - access("/etc/initrd-release", F_OK) >= 0; + if (!lenient) { + r = path_is_temporary_fs("/"); + if (r < 0) + log_debug_errno(r, "Couldn't determine if / is a temporary file system: %m"); + + saved_in_initrd = r > 0; + } + + if (saved_in_initrd != 0) + saved_in_initrd = access("/etc/initrd-release", F_OK) >= 0; return saved_in_initrd; } |