aboutsummaryrefslogtreecommitdiff
path: root/gdb/cli/cli-cmds.c
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2012-01-24 20:56:33 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2012-01-24 20:56:33 +0000
commit86eb7e951a825be0c81726558621161edf6858e9 (patch)
treebfdd8d38414ca26bb3fd4eec5126d74ef98a968d /gdb/cli/cli-cmds.c
parent30b91c90791df291e824964776a8c9c89d66d4bc (diff)
downloadgdb-86eb7e951a825be0c81726558621161edf6858e9.zip
gdb-86eb7e951a825be0c81726558621161edf6858e9.tar.gz
gdb-86eb7e951a825be0c81726558621161edf6858e9.tar.bz2
gdb/
Code cleanup. * cli/cli-cmds.c (source_script_from_stream): Never fclose STREAM. Update the function comment for it. (source_script_with_search): Call make_cleanup_fclose for STREAM. * cli/cli-script.c (script_from_file): Do not call make_cleanup_fclose for STREAM.
Diffstat (limited to 'gdb/cli/cli-cmds.c')
-rw-r--r--gdb/cli/cli-cmds.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index 91421aa..15b6b79 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -527,8 +527,7 @@ find_and_open_script (const char *script_file, int search_path,
return 1;
}
-/* Load script FILE, which has already been opened as STREAM.
- STREAM is closed before we return. */
+/* Load script FILE, which has already been opened as STREAM. */
static void
source_script_from_stream (FILE *stream, const char *file)
@@ -556,12 +555,9 @@ source_script_from_stream (FILE *stream, const char *file)
else
{
/* Nope, just punt. */
- fclose (stream);
throw_exception (e);
}
}
- else
- fclose (stream);
}
else
script_from_file (stream, file);
@@ -595,6 +591,7 @@ source_script_with_search (const char *file, int from_tty, int search_path)
}
old_cleanups = make_cleanup (xfree, full_path);
+ make_cleanup_fclose (stream);
/* The python support reopens the file, so we need to pass full_path here
in case the file was found on the search path. It's useful to do this
anyway so that error messages show the actual file used. But only do