Busybox 1.21.0 squashed commit for jellybean
Change-Id: I423c7fc1254050c6495126b1b18dd33af07fed6b
Signed-off-by: Tanguy Pruvot <tanguy.pruvot@gmail.com>
diff --git a/libbb/lineedit.c b/libbb/lineedit.c
index 69a1e7d..0da625f 100644
--- a/libbb/lineedit.c
+++ b/libbb/lineedit.c
@@ -2528,9 +2528,9 @@
/* Delete word forward */
int nc, sc = cursor;
ctrl_right();
- nc = cursor;
- input_backward(cursor - sc);
- while (--nc >= cursor)
+ nc = cursor - sc;
+ input_backward(nc);
+ while (--nc >= 0)
input_delete(1);
break;
}
@@ -2730,7 +2730,8 @@
{
fputs(prompt, stdout);
fflush_all();
- fgets(command, maxsize, stdin);
+ if (!fgets(command, maxsize, stdin))
+ return -1;
return strlen(command);
}