Commit bea3329b authored by Simon Marchi's avatar Simon Marchi
Browse files

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
parent 21f91785
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment