binutils-gdb/gdb/cli
Simon Marchi bea3329b76 gdb: check result of gdb_fopen_cloexec in dump_binary_file
Bug 27773 shows that passing a filename in a non-existent directory to
the "dump binary" command leads to a gdb crash.  This is because the
gdb_fopen_cloexec in dump_binary_file fails (returns nullptr) and the
return value is not checked.  Fix that by erroring out if
gdb_fopen_cloexec fails.

gdb/ChangeLog:

	PR gdb/27773
	* cli/cli-dump.c (dump_binary_file): Check result of
	gdb_fopen_cloexec.

gdb/testsuite/ChangeLog:

	PR gdb/27773
	* gdb.base/dump.exp: Test dump to non-existent dir.

Change-Id: Iea89a3bf9e6b9dcc31142faa5ae17bc855759328
2021-04-26 11:27:07 -04:00
..
cli-cmds.c gdb: move set remote commands to remote.c 2021-01-22 12:35:54 -05:00
cli-cmds.h Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
cli-decode.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
cli-decode.h Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
cli-dump.c gdb: check result of gdb_fopen_cloexec in dump_binary_file 2021-04-26 11:27:07 -04:00
cli-interp.c gdbsupport, gdb: give names to observers 2021-04-24 19:26:41 -04:00
cli-interp.h Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
cli-logging.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
cli-option.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
cli-option.h Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
cli-script.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
cli-script.h Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
cli-setshow.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
cli-setshow.h Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
cli-style.c gdb: add new version style 2021-01-22 19:09:31 +00:00
cli-style.h gdb: add new version style 2021-01-22 19:09:31 +00:00
cli-utils.c Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00
cli-utils.h Update copyright year range in all GDB files 2021-01-01 12:12:21 +04:00