From 64777391eb2bdc0d57319bb9895b840a4c60e475 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Thu, 5 May 2005 17:21:46 -0400 Subject: [PATCH] debugfs.c (do_stat): Check to make sure a filesystem is open and abort if with an error if not, to prevent a seg fault in that case. --- debugfs/ChangeLog | 6 ++++++ debugfs/debugfs.c | 3 +++ 2 files changed, 9 insertions(+) diff --git a/debugfs/ChangeLog b/debugfs/ChangeLog index fa2a335..994388d 100644 --- a/debugfs/ChangeLog +++ b/debugfs/ChangeLog @@ -1,3 +1,9 @@ +2005-05-05 Theodore Ts'o + + * debugfs.c (do_stat): Check to make sure a filesystem is open + and abort if with an error if not, to prevent a seg fault + in that case. + 2005-03-21 Theodore Ts'o * Release of E2fsprogs 1.37 diff --git a/debugfs/debugfs.c b/debugfs/debugfs.c index ca73c99..e923403 100644 --- a/debugfs/debugfs.c +++ b/debugfs/debugfs.c @@ -595,6 +595,9 @@ void do_stat(int argc, char *argv[]) ext2_ino_t inode; struct ext2_inode * inode_buf; + if (check_fs_open(argv[0])) + return 1; + inode_buf = (struct ext2_inode *) malloc(EXT2_INODE_SIZE(current_fs->super)); if (!inode_buf) { -- 1.8.3.1