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