From 18f734301012301efbeb87a7c67f6cf82f1721d7 Mon Sep 17 00:00:00 2001 From: Eric Sandeen Date: Wed, 8 Oct 2008 13:34:09 -0500 Subject: [PATCH] e2fsprogs: fix blkid detection of ext4dev as ext4 If only ext4 is available (as a module or in /proc/filesystems) blkid wasn't properly testing for it, because the time checks were backwards and always failed. This caused old ext4dev filesystems to fail to mount as ext4. With this patch it works fine. Also, don't try to check for modules on a non-Linux system. Signed-off-by: Eric Sandeen Signed-off-by: Theodore Ts'o --- lib/blkid/probe.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/blkid/probe.c b/lib/blkid/probe.c index 10ac803..71b00f4 100644 --- a/lib/blkid/probe.c +++ b/lib/blkid/probe.c @@ -26,7 +26,9 @@ #ifdef HAVE_SYS_MKDEV_H #include #endif +#ifdef __linux__ #include +#endif #ifdef HAVE_ERRNO_H #include #endif @@ -203,6 +205,7 @@ static int fs_proc_check(const char *fs_name) */ static int check_for_modules(const char *fs_name) { +#ifdef __linux__ struct utsname uts; FILE *f; char buf[1024], *cp, *t; @@ -234,6 +237,7 @@ static int check_for_modules(const char *fs_name) return (1); } fclose(f); +#endif return (0); } @@ -243,7 +247,7 @@ static int system_supports_ext4(void) static int ret = -1; time_t now = time(0); - if (ret != -1 || (last_check - now) < 5) + if (ret != -1 || (now - last_check) < 5) return ret; last_check = now; ret = (fs_proc_check("ext4") || check_for_modules("ext4")); @@ -256,7 +260,7 @@ static int system_supports_ext4dev(void) static int ret = -1; time_t now = time(0); - if (ret != -1 || (last_check - now) < 5) + if (ret != -1 || (now - last_check) < 5) return ret; last_check = now; ret = (fs_proc_check("ext4dev") || check_for_modules("ext4dev")); -- 1.8.3.1