aboutsummaryrefslogtreecommitdiffstats
path: root/debugfs/debugfs.c
diff options
context:
space:
mode:
authorEric Sandeen <sandeen@redhat.com>2009-01-29 17:46:28 -0500
committerTheodore Ts'o <tytso@mit.edu>2009-03-08 19:29:28 -0400
commiteefa4d950cf4da9a835812fe44fb7973ec147cbf (patch)
treebb1835b6a05f2323820a76eea5324c2759c31cee /debugfs/debugfs.c
parent9af62fde650003b9f0b67b77b020cfc770f9aa4c (diff)
downloadandroid_external_e2fsprogs-eefa4d950cf4da9a835812fe44fb7973ec147cbf.tar.gz
android_external_e2fsprogs-eefa4d950cf4da9a835812fe44fb7973ec147cbf.tar.bz2
android_external_e2fsprogs-eefa4d950cf4da9a835812fe44fb7973ec147cbf.zip
debugfs: fix segfault on "stat" command with no open fs
This is a regression from commit 8fdf29117f922419bd5b3f741e5d554b1d5b8893, which attempts to access current_fs via a feature check before we check that it's open. Just moving the feature check below the open check should fix it. Reported-by: Andrew Hecox <ahecox@redhat.com> Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'debugfs/debugfs.c')
-rw-r--r--debugfs/debugfs.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/debugfs/debugfs.c b/debugfs/debugfs.c
index 8b0965ec..95781d9b 100644
--- a/debugfs/debugfs.c
+++ b/debugfs/debugfs.c
@@ -291,9 +291,6 @@ void do_show_super_stats(int argc, char *argv[])
int c, header_only = 0;
int numdirs = 0, first, gdt_csum;
- gdt_csum = EXT2_HAS_RO_COMPAT_FEATURE(current_fs->super,
- EXT4_FEATURE_RO_COMPAT_GDT_CSUM);
-
reset_getopt();
while ((c = getopt (argc, argv, "h")) != EOF) {
switch (c) {
@@ -321,6 +318,8 @@ void do_show_super_stats(int argc, char *argv[])
return;
}
+ gdt_csum = EXT2_HAS_RO_COMPAT_FEATURE(current_fs->super,
+ EXT4_FEATURE_RO_COMPAT_GDT_CSUM);
gdp = &current_fs->group_desc[0];
for (i = 0; i < current_fs->group_desc_count; i++, gdp++) {
fprintf(out, " Group %2d: block bitmap at %u, "