mirror of https://github.com/vitalif/e2fsprogs
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 <sandeen@redhat.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>bitmap-optimize
parent
d58d8320e8
commit
18f7343010
|
@ -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"));
|
||||
|
|
Loading…
Reference in New Issue