]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
e2fsprogs: fix blkid detection of ext4dev as ext4
authorEric Sandeen <sandeen@redhat.com>
Wed, 8 Oct 2008 18:34:09 +0000 (13:34 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 13 Oct 2008 03:11:44 +0000 (23:11 -0400)
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 <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/blkid/probe.c

index 10ac8036c8b074101979438a5d6b51e2dbde0e83..71b00f4d3c8f07f23d8077d075ac4639f57ebd3a 100644 (file)
@@ -26,7 +26,9 @@
 #ifdef HAVE_SYS_MKDEV_H
 #include <sys/mkdev.h>
 #endif
+#ifdef __linux__
 #include <sys/utsname.h>
+#endif
 #ifdef HAVE_ERRNO_H
 #include <errno.h>
 #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"));