aboutsummaryrefslogtreecommitdiff
path: root/gdb/cli
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2012-01-23 16:37:03 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2012-01-23 16:37:03 +0000
commit77a35dd897bf8b3ea4a54f6da6043165d439dfd2 (patch)
tree9c5a0493ba8649bd8259237f49cb6d432a82a00b /gdb/cli
parenta71b5a3812de2a9da03eb91bc31df306f28c3d11 (diff)
downloadgdb-77a35dd897bf8b3ea4a54f6da6043165d439dfd2.zip
gdb-77a35dd897bf8b3ea4a54f6da6043165d439dfd2.tar.gz
gdb-77a35dd897bf8b3ea4a54f6da6043165d439dfd2.tar.bz2
gdb/
* cli/cli-cmds.c (find_and_open_script): Handle failure of fdopen.
Diffstat (limited to 'gdb/cli')
-rw-r--r--gdb/cli/cli-cmds.c11
1 files changed, 11 insertions, 0 deletions
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;
}