summaryrefslogtreecommitdiff
path: root/lib/librte_cmdline
diff options
context:
space:
mode:
authorCristian Dumitrescu <cristian.dumitrescu@intel.com>2014-05-23 16:21:24 +0100
committerThomas Monjalon <thomas.monjalon@6wind.com>2014-05-26 17:16:39 +0200
commitcd64eeac116d3bb4871d114b105440b4dd11b8e0 (patch)
treec58fcbc90f07fe372e00e5ae5c107f1552c697e4 /lib/librte_cmdline
parent174572477028b7f04700389e38f87d2ba01a0adc (diff)
downloaddpdk-cd64eeac116d3bb4871d114b105440b4dd11b8e0.zip
dpdk-cd64eeac116d3bb4871d114b105440b4dd11b8e0.tar.gz
dpdk-cd64eeac116d3bb4871d114b105440b4dd11b8e0.tar.xz
cmdline: fix infinite loop after EOF
Stop on EOF when reading commands from a file or a pipe. Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com> Acked-by: Olivier Matz <olivier.matz@6wind.com>
Diffstat (limited to 'lib/librte_cmdline')
-rwxr-xr-x[-rw-r--r--]lib/librte_cmdline/cmdline.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/librte_cmdline/cmdline.c b/lib/librte_cmdline/cmdline.c
index 03a3fac..b3dc17c 100644..100755
--- a/lib/librte_cmdline/cmdline.c
+++ b/lib/librte_cmdline/cmdline.c
@@ -256,7 +256,7 @@ cmdline_interact(struct cmdline *cl)
c = -1;
while (1) {
- if (read(cl->s_in, &c, 1) < 0)
+ if (read(cl->s_in, &c, 1) <= 0)
break;
if (cmdline_in(cl, &c, 1) < 0)
break;