On Wed, 25 Apr 2007, Diana Eichert wrote:

on further perusal through reboot.c I see where the "-p" switch only works if program is called as halt.

               case 'p':
                       /* Only works if we're called as halt. */
                       if (dohalt) {
                               pflag = 1;
                               howto |= RB_POWERDOWN;
                       }
                       break;

Shouldn't the check for "powerdown=YES in rc.shutdown" also be wrapped by something similar?

execl(_PATH_BSHELL, "sh", _PATH_RC, "shutdown", (char *)NULL);
                       _exit(1);
               default:
                       /* rc exits 2 if powerdown=YES in rc.shutdown */
                       waitpid(pid, &status, 0);
                       if (WIFEXITED(status) && WEXITSTATUS(status) == 2)
                               howto |= RB_POWERDOWN;

my quick hack

# diff -u sbin/reboot/reboot.c.orig sbin/reboot/reboot.c
--- sbin/reboot/reboot.c.orig   Wed Apr 25 18:45:23 2007
+++ sbin/reboot/reboot.c        Wed Apr 25 18:47:50 2007
@@ -201,8 +201,10 @@
                default:
                        /* rc exits 2 if powerdown=YES in rc.shutdown */
                        waitpid(pid, &status, 0);
-                       if (WIFEXITED(status) && WEXITSTATUS(status) == 2)
-                               howto |= RB_POWERDOWN;
+                       if (dohalt) {
+                               if (WIFEXITED(status) && WEXITSTATUS(status) == 
2)
+                                       howto |= RB_POWERDOWN;
+                       }
                }
        }

#

"shutdown -r now" and "reboot" now run rc.shutdown, sync disks and reboot as expected

diana

Reply via email to