From dde6333b9658afa0dcd30fe9628857dd694509c6 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Tue, 4 Mar 2014 19:05:00 -0500 Subject: [PATCH] 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 --- e2fsck/unix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2fsck/unix.c b/e2fsck/unix.c index 6f94644..23316b8 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; -- 1.8.3.1