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.
[kzak@redhat.com: port from e2fsprogs to util-linux-ng tree]
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Karel Zak <kzak@redhat.com>
#ifdef HAVE_SYS_MKDEV_H
#include <sys/mkdev.h>
#endif
-#include <sys/utsname.h>
#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif
#include <errno.h>
#include <ctype.h>
#include <stdint.h>
+#ifdef __linux__
#include <sys/utsname.h>
+#endif
#include <time.h>
#include "blkidP.h"
*/
static int check_for_modules(const char *fs_name)
{
+#ifdef __linux__
struct utsname uts;
FILE *f;
char buf[1024], *cp, *t;
return 1;
}
fclose(f);
+#endif /* __linux__ */
return 0;
}
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"));
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"));