gdbstub: fix gdbserver_fork
As reported by Martin Mohring fork doesn't work with NPTL.
A fix is attached that makes the also attached test run
(tested with ARM CodeSourcery 2008q3 on an x86_64
Fedora Core with kernel 2.6.23).
Signed-off-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Acked-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6195 c046a42c-6fe2-441c-8c8c-71466251a162
diff --git a/gdbstub.c b/gdbstub.c
index 6c6a7aa..b8198ee 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -2225,7 +2225,7 @@
void gdbserver_fork(CPUState *env)
{
GDBState *s = gdbserver_state;
- if (s->fd < 0)
+ if (gdbserver_fd < 0 || s->fd < 0)
return;
close(s->fd);
s->fd = -1;