aboutsummaryrefslogtreecommitdiff
path: root/gdb/utils.c
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2001-02-07 03:44:24 +0000
committerAndrew Cagney <cagney@redhat.com>2001-02-07 03:44:24 +0000
commitf042532cc45b763942ffff337e6b20c9f864525b (patch)
treee3170220e750527427e5b9c74b117a5392e0b39c /gdb/utils.c
parent58cfabe6f8b559d79be8946424e263e5ecc955f2 (diff)
downloadgdb-f042532cc45b763942ffff337e6b20c9f864525b.zip
gdb-f042532cc45b763942ffff337e6b20c9f864525b.tar.gz
gdb-f042532cc45b763942ffff337e6b20c9f864525b.tar.bz2
* sol-thread.c (restore_inferior_pid): Save the PID in a freshly
allocated buffer. (save_inferior_pid): Restore the PID from that tempoary buffer. Delete the buffer. * utils.c (make_cleanup_close, do_close_cleanup): Ditto for FD.
Diffstat (limited to 'gdb/utils.c')
-rw-r--r--gdb/utils.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/gdb/utils.c b/gdb/utils.c
index 0d89cb7..164bc9c 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -215,14 +215,17 @@ make_cleanup_bfd_close (bfd *abfd)
static void
do_close_cleanup (void *arg)
{
- close ((int) arg);
+ int *fd = arg;
+ close (*fd);
+ xfree (fd);
}
struct cleanup *
make_cleanup_close (int fd)
{
- /* int into void*. Outch!! */
- return make_cleanup (do_close_cleanup, (void *) fd);
+ int *saved_fd = xmalloc (sizeof (fd));
+ *saved_fd = fd;
+ return make_cleanup (do_close_cleanup, saved_fd);
}
static void