df98bb
From 42f639d3689b7cbc9ce6b9578a2790c254508384 Mon Sep 17 00:00:00 2001
df98bb
From: Kairui Song <kasong@redhat.com>
df98bb
Date: Fri, 8 Jan 2021 14:52:26 +0800
df98bb
Subject: [PATCH] util: rework in_initrd() to make use of
df98bb
 path_is_temporary_fs()
df98bb
df98bb
(cherry picked from commit 96cceb35e7985f5ee6c9b17e129a76259273cdde)
df98bb
df98bb
Related: #1959339
df98bb
---
df98bb
 src/basic/util.c | 4 +---
df98bb
 1 file changed, 1 insertion(+), 3 deletions(-)
df98bb
df98bb
diff --git a/src/basic/util.c b/src/basic/util.c
df98bb
index 82cb937314..b443e639f3 100644
df98bb
--- a/src/basic/util.c
df98bb
+++ b/src/basic/util.c
df98bb
@@ -130,7 +130,6 @@ int prot_from_flags(int flags) {
df98bb
 }
df98bb
 
df98bb
 bool in_initrd(void) {
df98bb
-        struct statfs s;
df98bb
 
df98bb
         if (saved_in_initrd >= 0)
df98bb
                 return saved_in_initrd;
df98bb
@@ -146,8 +145,7 @@ bool in_initrd(void) {
df98bb
          */
df98bb
 
df98bb
         saved_in_initrd = access("/etc/initrd-release", F_OK) >= 0 &&
df98bb
-                          statfs("/", &s) >= 0 &&
df98bb
-                          is_temporary_fs(&s);
df98bb
+                          path_is_temporary_fs("/") > 0;
df98bb
 
df98bb
         return saved_in_initrd;
df98bb
 }