aboutsummaryrefslogtreecommitdiff
path: root/gdb/cli/cli-cmds.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/cli/cli-cmds.c')
-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;
}