cmdline: fix infinite loop after EOF
authorCristian Dumitrescu <cristian.dumitrescu@intel.com>
Fri, 23 May 2014 15:21:24 +0000 (16:21 +0100)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Mon, 26 May 2014 15:16:39 +0000 (17:16 +0200)
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>
lib/librte_cmdline/cmdline.c [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 03a3fac..b3dc17c
@@ -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;