remsim-client-shell: Terminate if STDIN has been closed

Change-Id: I39937224b06b6bb6f23c002023141882797ee6a6
This commit is contained in:
Harald Welte 2020-07-19 09:54:11 +02:00
parent b80fcf0bd7
commit 3f65972ed6
1 changed files with 4 additions and 0 deletions

View File

@ -134,6 +134,10 @@ static int stdin_fd_cb(struct osmo_fd *ofd, unsigned int what)
rc = read(ofd->fd, cur, msgb_tailroom(ss->rx_msg)); rc = read(ofd->fd, cur, msgb_tailroom(ss->rx_msg));
if (rc < 0) if (rc < 0)
return rc; return rc;
if (rc == 0) {
fprintf(stderr, "STDIN was closed, terminating");
exit(0);
}
msgb_put(ss->rx_msg, rc); msgb_put(ss->rx_msg, rc);
for (i = 0; i < rc; i++) { for (i = 0; i < rc; i++) {