Merge branch 'em/missing-pager'
When a non-existent program is given as the pager, we tried to reuse an uninitialized child_process structure and crashed, which has been fixed. * em/missing-pager: pager: fix crash when pager program doesn't exist
This commit is contained in:
4
pager.c
4
pager.c
@ -8,7 +8,7 @@
|
|||||||
#define DEFAULT_PAGER "less"
|
#define DEFAULT_PAGER "less"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static struct child_process pager_process = CHILD_PROCESS_INIT;
|
static struct child_process pager_process;
|
||||||
static const char *pager_program;
|
static const char *pager_program;
|
||||||
|
|
||||||
/* Is the value coming back from term_columns() just a guess? */
|
/* Is the value coming back from term_columns() just a guess? */
|
||||||
@ -124,6 +124,8 @@ void setup_pager(void)
|
|||||||
|
|
||||||
setenv("GIT_PAGER_IN_USE", "true", 1);
|
setenv("GIT_PAGER_IN_USE", "true", 1);
|
||||||
|
|
||||||
|
child_process_init(&pager_process);
|
||||||
|
|
||||||
/* spawn the pager */
|
/* spawn the pager */
|
||||||
prepare_pager_args(&pager_process, pager);
|
prepare_pager_args(&pager_process, pager);
|
||||||
pager_process.in = -1;
|
pager_process.in = -1;
|
||||||
|
@ -760,4 +760,9 @@ test_expect_success TTY 'git returns SIGPIPE on propagated signals from pager' '
|
|||||||
test_path_is_file pager-used
|
test_path_is_file pager-used
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success TTY 'non-existent pager doesnt cause crash' '
|
||||||
|
test_config pager.show invalid-pager &&
|
||||||
|
test_terminal git show
|
||||||
|
'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
Reference in New Issue
Block a user