busybox-1.9.0-msh.patch 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. --- busybox-1.9.0/include/libbb.h Fri Dec 21 22:00:31 2007
  2. +++ busybox-1.9.0-msh/include/libbb.h Sat Feb 2 18:55:36 2008
  3. @@ -950,10 +950,9 @@
  4. };
  5. line_input_t *new_line_input_t(int flags);
  6. /* Returns:
  7. - * -1 on read errors or EOF, or on bare Ctrl-D.
  8. - * 0 on ctrl-C,
  9. + * -1 on read errors or EOF, or on bare Ctrl-D,
  10. + * 0 on ctrl-C (the line entered is still returned in 'command'),
  11. * >0 length of input string, including terminating '\n'
  12. - * [is this true? stores "" in 'command' if return value is 0 or -1]
  13. */
  14. int read_line_input(const char* prompt, char* command, int maxsize, line_input_t *state);
  15. #else
  16. --- busybox-1.9.0/libbb/lineedit.c Mon Dec 24 14:08:25 2007
  17. +++ busybox-1.9.0-msh/libbb/lineedit.c Sat Feb 2 18:55:36 2008
  18. @@ -1315,8 +1315,8 @@
  19. #define CTRL(a) ((a) & ~0x40)
  20. /* Returns:
  21. - * -1 on read errors or EOF, or on bare Ctrl-D.
  22. - * 0 on ctrl-C,
  23. + * -1 on read errors or EOF, or on bare Ctrl-D,
  24. + * 0 on ctrl-C (the line entered is still returned in 'command'),
  25. * >0 length of input string, including terminating '\n'
  26. */
  27. int read_line_input(const char *prompt, char *command, int maxsize, line_input_t *st)
  28. --- busybox-1.9.0/shell/msh.c Fri Dec 21 22:00:28 2007
  29. +++ busybox-1.9.0-msh/shell/msh.c Sat Feb 2 18:57:12 2008
  30. @@ -2825,11 +2825,13 @@
  31. if (pin != NULL) {
  32. xmove_fd(pin[0], 0);
  33. - if (pin[1] != 0) close(pin[1]);
  34. + if (pin[1] != 0)
  35. + close(pin[1]);
  36. }
  37. if (pout != NULL) {
  38. xmove_fd(pout[1], 1);
  39. - if (pout[1] != 1) close(pout[0]);
  40. + if (pout[1] != 1)
  41. + close(pout[0]);
  42. }
  43. iopp = t->ioact;
  44. @@ -4162,7 +4164,7 @@
  45. return 0;
  46. }
  47. if (i != 0) {
  48. - waitpid(i, NULL, 0);
  49. + waitpid(i, NULL, 0); // safe_waitpid?
  50. global_env.iop->argp->aword = ++cp;
  51. close(pf[1]);
  52. PUSHIO(afile, remap(pf[0]),
  53. @@ -4181,7 +4183,8 @@
  54. * echo "$files" >zz
  55. */
  56. xmove_fd(pf[1], 1);
  57. - if (pf[0] != 1) close(pf[0]);
  58. + if (pf[0] != 1)
  59. + close(pf[0]);
  60. argument_list[0] = (char *) DEFAULT_SHELL;
  61. argument_list[1] = (char *) "-c";
  62. @@ -4834,9 +4837,11 @@
  63. static int position = 0, size = 0;
  64. while (size == 0 || position >= size) {
  65. - read_line_input(current_prompt, filechar_cmdbuf, BUFSIZ, line_input_state);
  66. - size = strlen(filechar_cmdbuf);
  67. + size = read_line_input(current_prompt, filechar_cmdbuf, BUFSIZ, line_input_state);
  68. + if (size < 0) /* Error/EOF */
  69. + exit(0);
  70. position = 0;
  71. + /* if Ctrl-C, size == 0 and loop will repeat */
  72. }
  73. c = filechar_cmdbuf[position];
  74. position++;