diff options
author | Andrew Cagney <cagney@redhat.com> | 2001-02-07 03:44:24 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 2001-02-07 03:44:24 +0000 |
commit | f042532cc45b763942ffff337e6b20c9f864525b (patch) | |
tree | e3170220e750527427e5b9c74b117a5392e0b39c /gdb/sol-thread.c | |
parent | 58cfabe6f8b559d79be8946424e263e5ecc955f2 (diff) | |
download | gdb-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/sol-thread.c')
-rw-r--r-- | gdb/sol-thread.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c index f7727b4..f266902 100644 --- a/gdb/sol-thread.c +++ b/gdb/sol-thread.c @@ -424,13 +424,17 @@ lwp_to_thread (int lwp) static struct cleanup * save_inferior_pid (void) { - return make_cleanup (restore_inferior_pid, (void *) inferior_pid); + int *saved_pid = xmalloc (sizeof (int)); + *saved_pid = inferior_pid; + return make_cleanup (restore_inferior_pid, saved_pid); } static void -restore_inferior_pid (void *pid) +restore_inferior_pid (void *data) { - inferior_pid = (int) pid; + int *saved_pid = data; + inferior_pid = *saved_pid; + xfree (saved_pid); } |