diff options
-rw-r--r-- | extlinux/extlinux.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/extlinux/extlinux.c b/extlinux/extlinux.c index 58261b44..742859a9 100644 --- a/extlinux/extlinux.c +++ b/extlinux/extlinux.c @@ -36,6 +36,7 @@ typedef uint64_t u64; #include <sys/stat.h> #include <sys/types.h> #include <sys/mount.h> +#include <sys/vfs.h> #include <linux/fd.h> /* Floppy geometry */ #include <linux/hdreg.h> /* Hard disk geometry */ @@ -804,6 +805,7 @@ install_loader(const char *path, int update_only) struct stat st, fst; int devfd, rv; const char *devname = NULL; + struct statfs sfs; #ifndef __KLIBC__ struct mntent *mnt = NULL; struct stat dst; @@ -815,6 +817,16 @@ install_loader(const char *path, int update_only) return 1; } + if ( statfs(path, &sfs) ) { + fprintf(stderr, "%s: statfs %s: %s\n", program, path, strerror(errno)); + return 1; + } + + if ( sfs.f_type != EXT2_SUPER_MAGIC ) { + fprintf(stderr, "%s: not an ext2/ext3 filesystem: %s\n", program, path); + return 1; + } + devfd = -1; #ifdef __KLIBC__ |