Whamcloud - gitweb
dumpe2fs: don't crash when the user provides no block device argument
authorDarrick J. Wong <darrick.wong@oracle.com>
Sat, 8 Nov 2014 02:26:14 +0000 (21:26 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 8 Nov 2014 02:26:14 +0000 (21:26 -0500)
If the user doesn't provide any arguments, the guard fails to run and
the whole thing segfaults on ext2fs_open2().  Don't do that.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
misc/dumpe2fs.c

index 1eae5a3..4185d6e 100644 (file)
@@ -575,7 +575,7 @@ int main (int argc, char ** argv)
                        usage();
                }
        }
-       if (argc - 1 > optind) {
+       if (optind != argc - 1) {
                usage();
                exit(1);
        }