From 77a35dd897bf8b3ea4a54f6da6043165d439dfd2 Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Mon, 23 Jan 2012 16:37:03 +0000 Subject: gdb/ * cli/cli-cmds.c (find_and_open_script): Handle failure of fdopen. --- gdb/ChangeLog | 4 ++++ gdb/cli/cli-cmds.c | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 932c035..b73d98f 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2012-01-23 Jan Kratochvil + + * cli/cli-cmds.c (find_and_open_script): Handle failure of fdopen. + 2012-01-23 Ulrich Weigand * inf-child.c: Include "gdb_stat.h" instead of . diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index c38167a..91421aa 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -513,6 +513,17 @@ find_and_open_script (const char *script_file, int search_path, do_cleanups (old_cleanups); *streamp = fdopen (fd, FOPEN_RT); + if (*streamp == NULL) + { + int save_errno = errno; + + close (fd); + if (full_pathp) + xfree (*full_pathp); + errno = save_errno; + return 0; + } + return 1; } -- cgit v1.1