From 3f65972ed675a6c48ec36d989ef3d53207d8bffd Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sun, 19 Jul 2020 09:54:11 +0200 Subject: [PATCH] remsim-client-shell: Terminate if STDIN has been closed Change-Id: I39937224b06b6bb6f23c002023141882797ee6a6 --- src/client/user_shell.c | 4 ++++ 1 file changed, 4 insertions(+) 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 @@ static int stdin_fd_cb(struct osmo_fd *ofd, unsigned int what) 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++) {