busybox-1.13.2-init.patch 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. --- busybox-1.13.2/init/init.c Wed Dec 31 04:06:45 2008
  2. +++ busybox-1.13.2-init/init/init.c Thu Jan 29 03:02:13 2009
  3. @@ -671,15 +671,14 @@
  4. */
  5. static void parse_inittab(void)
  6. {
  7. +#if ENABLE_FEATURE_USE_INITTAB
  8. char *token[4];
  9. - /* order must correspond to SYSINIT..RESTART constants */
  10. - static const char actions[] ALIGN1 =
  11. - "sysinit\0""respawn\0""askfirst\0""wait\0""once\0"
  12. - "ctrlaltdel\0""shutdown\0""restart\0";
  13. + parser_t *parser = config_open2("/etc/inittab", fopen_for_read);
  14. - parser_t *parser = config_open2(INITTAB, fopen_for_read);
  15. - /* No inittab file -- set up some default behavior */
  16. - if (parser == NULL) {
  17. + if (parser == NULL)
  18. +#endif
  19. + {
  20. + /* No inittab file -- set up some default behavior */
  21. /* Reboot on Ctrl-Alt-Del */
  22. new_init_action(CTRLALTDEL, "reboot", "");
  23. /* Umount all filesystems on halt/reboot */
  24. @@ -699,11 +698,17 @@
  25. new_init_action(SYSINIT, INIT_SCRIPT, "");
  26. return;
  27. }
  28. +
  29. +#if ENABLE_FEATURE_USE_INITTAB
  30. /* optional_tty:ignored_runlevel:action:command
  31. * Delims are not to be collapsed and need exactly 4 tokens
  32. */
  33. while (config_read(parser, token, 4, 0, "#:",
  34. PARSE_NORMAL & ~(PARSE_TRIM | PARSE_COLLAPSE))) {
  35. + /* order must correspond to SYSINIT..RESTART constants */
  36. + static const char actions[] ALIGN1 =
  37. + "sysinit\0""respawn\0""askfirst\0""wait\0""once\0"
  38. + "ctrlaltdel\0""shutdown\0""restart\0";
  39. int action;
  40. char *tty = token[0];
  41. @@ -727,6 +732,7 @@
  42. parser->lineno);
  43. }
  44. config_close(parser);
  45. +#endif
  46. }
  47. #if ENABLE_FEATURE_USE_INITTAB