summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2019-08-31 23:20:07 +0000
committermidipix <writeonce@midipix.org>2019-08-31 23:20:07 +0000
commitcfa0975ec50dcb81b2a3cbfc36eda9761b63d032 (patch)
tree404a7641b882108543317fb27d7c0f5f1133f0dd
parent900be936926281ef6853e1e9cbf73d21796fa510 (diff)
downloadchainport-cfa0975ec50dcb81b2a3cbfc36eda9761b63d032.tar.bz2
chainport-cfa0975ec50dcb81b2a3cbfc36eda9761b63d032.tar.xz
mgdb: close process file descriptor upon detaching.
-rw-r--r--overlay/mgdb/gdb/winnt-nat.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/overlay/mgdb/gdb/winnt-nat.c b/overlay/mgdb/gdb/winnt-nat.c
index 71d279b..cdfa210 100644
--- a/overlay/mgdb/gdb/winnt-nat.c
+++ b/overlay/mgdb/gdb/winnt-nat.c
@@ -158,12 +158,14 @@ static void winnt_attach (struct target_ops * t, const char * args, int from_tty
if (__dbg_rbreak(pfd) < 0) {
__dbg_detach(pfd);
+ close(pfd);
winnt_perror ("could not issue a breakpoint in process",pid);
}
if (winnt_plist_add(pid,pfd) < 0) {
__dbg_detach(pfd);
+ close(pfd);
winnt_error ("could not expand debuggee list");
}
}
@@ -182,6 +184,9 @@ static void winnt_detach (struct target_ops * t, const char * args, int from_tty
if (__dbg_detach(pfd) < 0)
winnt_perror ("could not attach from process",pid);
+ if (close(pfd) < 0)
+ winnt_perror ("failed to close process file descriptor",pid);
+
winnt_plist_remove(pid);
x86_cleanup_dregs();