gdbc: check for Ctrl+C portably.
This commit is contained in:
parent
edf625929c
commit
bc69c3d065
8
gdbc.c
8
gdbc.c
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue