From: Theodore Ts'o Date: Wed, 5 Mar 2014 00:05:00 +0000 (-0500) Subject: e2fsck: always make sure e2fsck_global_ctx is set X-Git-Tag: v1.42.10~50 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dde6333b9658afa0dcd30fe9628857dd694509c6;p=thirdparty%2Fe2fsprogs.git e2fsck: always make sure e2fsck_global_ctx is set The e2fsck_global_ctx varible was only being set if HAVE_SIGNAL_H is defined. There are systems, such as Android, where this is not true. This was causing e2fsck_set_bitmap_type() to seg fault since e2fsck_global_ctx was not NULL. Signed-off-by: "Theodore Ts'o" Reported-by: JP Abgrall --- diff --git a/e2fsck/unix.c b/e2fsck/unix.c index 6f94644e0..23316b89d 100644 --- a/e2fsck/unix.c +++ b/e2fsck/unix.c @@ -749,6 +749,7 @@ static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx) return retval; *ret_ctx = ctx; + e2fsck_global_ctx = ctx; setvbuf(stdout, NULL, _IONBF, BUFSIZ); setvbuf(stderr, NULL, _IONBF, BUFSIZ); @@ -990,7 +991,6 @@ static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx) #ifdef SA_RESTART sa.sa_flags = SA_RESTART; #endif - e2fsck_global_ctx = ctx; sa.sa_handler = signal_progress_on; sigaction(SIGUSR1, &sa, 0); sa.sa_handler = signal_progress_off;