commit | 3f65972ed675a6c48ec36d989ef3d53207d8bffd | [log] [tgz] |
---|---|---|
author | Harald Welte <laforge@osmocom.org> | Sun Jul 19 09:54:11 2020 +0200 |
committer | Harald Welte <laforge@osmocom.org> | Sun Jul 19 09:54:37 2020 +0200 |
tree | 2ae4f6ec32c10898e384f8e65a1595db47db1c72 | |
parent | b80fcf0bd7753c6df26dbaf69758eb4f29da1a30 [diff] |
remsim-client-shell: Terminate if STDIN has been closed Change-Id: I39937224b06b6bb6f23c002023141882797ee6a6
diff --git a/src/client/user_shell.c b/src/client/user_shell.c index c8f1b5f..b22ee9a 100644 --- a/src/client/user_shell.c +++ b/src/client/user_shell.c
@@ -134,6 +134,10 @@ rc = read(ofd->fd, cur, msgb_tailroom(ss->rx_msg)); if (rc < 0) return rc; + if (rc == 0) { + fprintf(stderr, "STDIN was closed, terminating"); + exit(0); + } msgb_put(ss->rx_msg, rc); for (i = 0; i < rc; i++) {