summaryrefslogtreecommitdiff
path: root/src/gsmd
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2013-09-27 22:48:56 +0200
committerHarald Welte <laforge@gnumonks.org>2013-09-29 14:56:41 +0200
commit292e73a08c3445b4aa96057e559dbcec44b0d8f7 (patch)
tree7e4d024ffc403ea20c972159d4f9a62631ecb484 /src/gsmd
parent0768e7c1ba0e0aacd1fbd38a41e6ac0734c07440 (diff)
make gsmd fail if the serial device disappears
If the serial device disappears (e.g. because of a USB bus reset), there's no point continuing. We simply exit() gsmd and wait for somebody else (init?) to re-spawn us.
Diffstat (limited to 'src/gsmd')
-rw-r--r--src/gsmd/atcmd.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/gsmd/atcmd.c b/src/gsmd/atcmd.c
index faa91f3..3d4fe4b 100644
--- a/src/gsmd/atcmd.c
+++ b/src/gsmd/atcmd.c
@@ -492,9 +492,10 @@ static int atcmd_select_cb(int fd, unsigned int what, void *data)
if (len < 0) {
if (errno == EAGAIN)
return 0;
- gsmd_log(GSMD_NOTICE, "ERROR reading from fd %u: %d (%s)\n", fd, len,
+ gsmd_log(GSMD_FATAL, "ERROR reading from fd %u: %d (%s)\n", fd, len,
strerror(errno));
return len;
+ exit(3);
}
rc = llparse_string(&g->llp, rxbuf, len);
if (rc < 0) {
@@ -518,8 +519,9 @@ static int atcmd_select_cb(int fd, unsigned int what, void *data)
gsmd_log(GSMD_ERROR, "write returns 0, aborting\n");
break;
} else if (rc < 0) {
- gsmd_log(GSMD_ERROR, "error during write to fd %d: %d\n",
+ gsmd_log(GSMD_FATAL, "error during write to fd %d: %d\n",
fd, rc);
+ exit(3);
return rc;
}
if (!cr || rc == len)
personal git repositories of Harald Welte. Your mileage may vary