summaryrefslogtreecommitdiffstats
path: root/sys-utils/switch_root.c
diff options
context:
space:
mode:
authorKarel Zak2014-11-06 12:50:27 +0100
committerKarel Zak2014-11-06 12:50:27 +0100
commit8f806bb1ea30f15db7ca36d1cfa79349f8115302 (patch)
tree7128f0c36bc2d04ca4513f11fe3daf631845762a /sys-utils/switch_root.c
parentlib/loopdev: remove test program (diff)
downloadkernel-qcow2-util-linux-8f806bb1ea30f15db7ca36d1cfa79349f8115302.tar.gz
kernel-qcow2-util-linux-8f806bb1ea30f15db7ca36d1cfa79349f8115302.tar.xz
kernel-qcow2-util-linux-8f806bb1ea30f15db7ca36d1cfa79349f8115302.zip
switch_root: improve statfs->f_type portability
__SWORD_TYPE is not available everywhere, for example it's not defined by musl libc. It also seems that __SWORD_TYPE is not used for f_type on some architectures (s390x). Reported-by: Natanael Copa <ncopa@alpinelinux.org> Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'sys-utils/switch_root.c')
-rw-r--r--sys-utils/switch_root.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys-utils/switch_root.c b/sys-utils/switch_root.c
index 6822a5d0c..c6a2eff8e 100644
--- a/sys-utils/switch_root.c
+++ b/sys-utils/switch_root.c
@@ -181,8 +181,8 @@ static int switchroot(const char *newroot)
if (pid <= 0) {
struct statfs stfs;
if (fstatfs(cfd, &stfs) == 0 &&
- (stfs.f_type == (__SWORD_TYPE)STATFS_RAMFS_MAGIC ||
- stfs.f_type == (__SWORD_TYPE)STATFS_TMPFS_MAGIC))
+ (stfs.f_type == (ul_statfs_ftype_t) STATFS_RAMFS_MAGIC ||
+ stfs.f_type == (ul_statfs_ftype_t) STATFS_TMPFS_MAGIC))
recursiveRemove(cfd);
else
warn(_("old root filesystem is not an initramfs"));