]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
include/statfs_magic: use macro rather than type for f_type
authorKarel Zak <kzak@redhat.com>
Mon, 10 Nov 2014 10:29:42 +0000 (11:29 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 10 Nov 2014 10:29:42 +0000 (11:29 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
include/statfs_magic.h
sys-utils/switch_root.c

index d27be1cffb58705836d01488e17c0e355ea522c9..7397a4e5da844c5a20466441e0248dc7548d0945 100644 (file)
@@ -7,9 +7,9 @@
  * If possible then don't depend on internal libc __SWORD_TYPE type.
  */
 #ifdef __GNUC__
-typedef __typeof__( ((struct statfs *)0)->f_type )     ul_statfs_ftype_t;
+#define F_TYPE_EQUAL(a, b) (a == (__typeof__(a)) b)
 #else
-typedef __SWORD_TYPE   ul_statfs_ftype_t;
+#define F_TYPE_EQUAL(a, b) (a == (__SWORD_TYPE) b)
 #endif
 
 /*
index c6a2eff8e7352efe5283ee9127c439255387b3e6..534d44ac70b4441d819c8f9fb63b9ffef6b895d9 100644 (file)
@@ -181,8 +181,8 @@ static int switchroot(const char *newroot)
                if (pid <= 0) {
                        struct statfs stfs;
                        if (fstatfs(cfd, &stfs) == 0 &&
-                           (stfs.f_type == (ul_statfs_ftype_t) STATFS_RAMFS_MAGIC ||
-                            stfs.f_type == (ul_statfs_ftype_t) STATFS_TMPFS_MAGIC))
+                           (F_TYPE_EQUAL(stfs.f_type, STATFS_RAMFS_MAGIC) ||
+                            F_TYPE_EQUAL(stfs.f_type, STATFS_TMPFS_MAGIC)))
                                recursiveRemove(cfd);
                        else
                                warn(_("old root filesystem is not an initramfs"));