diff options
author | Gary Benson <gbenson@redhat.com> | 2015-04-29 15:20:22 +0100 |
---|---|---|
committer | Gary Benson <gbenson@redhat.com> | 2015-04-29 15:20:22 +0100 |
commit | 998d2a3ef31378d3d980972dc68f4926b720a7e9 (patch) | |
tree | 368ec6a68f148273e08b1ebd73641e0182f21666 /gdb/infrun.c | |
parent | a93d5cb1976818c8d34133fd8798b3df76269f80 (diff) | |
download | binutils-998d2a3ef31378d3d980972dc68f4926b720a7e9.zip binutils-998d2a3ef31378d3d980972dc68f4926b720a7e9.tar.gz binutils-998d2a3ef31378d3d980972dc68f4926b720a7e9.tar.bz2 |
Allow passing fd == NULL to exec_file_find and solib_find
This commit allows NULL to be passed as the int *fd argument
to exec_file_find and solib_find to simplify use cases where
the caller does not require the file to be opened.
gdb/ChangeLog:
* solib.c (solib_find_1): Allow fd argument to be NULL.
(exec_file_find): Update comment.
(solib_find): Likewise.
* exec.c (exec_file_locate_attach): Use NULL as fd
argument to exec_file_find to avoid having to close
the opened file.
* infrun.c (follow_exec): Likewise.
Diffstat (limited to 'gdb/infrun.c')
-rw-r--r-- | gdb/infrun.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/gdb/infrun.c b/gdb/infrun.c index f09e2da..a4f0b9f 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -1136,12 +1136,7 @@ follow_exec (ptid_t ptid, char *execd_pathname) if (gdb_sysroot != NULL && *gdb_sysroot != '\0') { - int fd = -1; - char *name; - - name = exec_file_find (execd_pathname, &fd); - if (fd >= 0) - close (fd); + char *name = exec_file_find (execd_pathname, NULL); execd_pathname = alloca (strlen (name) + 1); strcpy (execd_pathname, name); |