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