gdbc: check for Ctrl+C portably.

This commit is contained in:
Daniel Beer 2011-09-13 14:01:15 +12:00
parent edf625929c
commit bc69c3d065
1 changed files with 4 additions and 4 deletions

8
gdbc.c
View File

@ -19,7 +19,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <errno.h>
#include "sockets.h" #include "sockets.h"
#include "output.h" #include "output.h"
@ -325,11 +324,12 @@ static device_status_t gdbc_poll(device_t dev_base)
if (!dev->is_running) if (!dev->is_running)
return DEVICE_STATUS_HALTED; return DEVICE_STATUS_HALTED;
ctrlc_reset();
len = gdb_peek(&dev->gdb, 50); len = gdb_peek(&dev->gdb, 50);
if (len < 0) { if (ctrlc_check())
if (errno == EINTR) return DEVICE_STATUS_INTR;
return DEVICE_STATUS_INTR;
if (len < 0) {
dev->is_running = 0; dev->is_running = 0;
return DEVICE_STATUS_ERROR; return DEVICE_STATUS_ERROR;
} }