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>
This commit is contained in:
Cristian Dumitrescu 2014-05-23 16:21:24 +01:00 committed by Thomas Monjalon
parent 1745724770
commit cd64eeac11

2
lib/librte_cmdline/cmdline.c Normal file → Executable file
View File

@ -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;