1
0
forked from pool/util-linux
util-linux/linux-fs.patch

55 lines
1.6 KiB
Diff

From 89c7c6ea6ef12722eac31c18b8fa6fbcf429525b Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Wed, 20 Jul 2022 16:55:02 +0200
Subject: [PATCH] sulogin: fix includes
* support --enable-sulogin-emergency-mount on Linux only
* don't include unnecessary linux/magic.h
* don't include linux/fs.h, sys/mount.h should be enough, otherwise
define a fallback for MS_RELATIME
Reported-by: Andreas Schwab <schwab@suse.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
---
configure.ac | 2 ++
login-utils/sulogin-consoles.c | 7 ++++---
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/configure.ac b/configure.ac
index 824e8bbd2..51deeecd4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2615,6 +2615,8 @@ AC_ARG_ENABLE([sulogin-emergency-mount],
)
AS_IF([test "x$enable_sulogin_emergency_mount" = xyes], [
+ AS_IF([test "x$linux_os" = xyes], [ ],
+ [AC_MSG_ERROR([--enable-sulogin-emergency-mount selected for non-linux system])])
AC_DEFINE([USE_SULOGIN_EMERGENCY_MOUNT], [1],
[Should sulogin use an emergency mount of /dev and /proc?])
])
diff --git a/login-utils/sulogin-consoles.c b/login-utils/sulogin-consoles.c
index 9ae4b2eba..9ae525556 100644
--- a/login-utils/sulogin-consoles.c
+++ b/login-utils/sulogin-consoles.c
@@ -41,10 +41,11 @@
#include <fcntl.h>
#include <unistd.h>
-#ifdef USE_SULOGIN_EMERGENCY_MOUNT
+#if defined(USE_SULOGIN_EMERGENCY_MOUNT)
# include <sys/mount.h>
-# include <linux/fs.h>
-# include <linux/magic.h>
+# ifndef MS_RELATIME
+# define MS_RELATIME (1<<21)
+# endif
# ifndef MNT_DETACH
# define MNT_DETACH 2
# endif
--
2.37.1