Index: gdbstub.c =================================================================== --- gdbstub.c (revision 6146) +++ gdbstub.c (working copy) @@ -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;