[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: halt with powerdown



Il giorno mar, 04/04/2006 alle 15.56 +0200, Michele 'mydecay' Marchetto
ha scritto:
> This patch should fix :)

really sorry. here is the patch:

Index: src/sbin/reboot/reboot.c
===================================================================
RCS file: /cvs/src/sbin/reboot/reboot.c,v
retrieving revision 1.26
diff -u -r1.26 reboot.c
--- src/sbin/reboot/reboot.c    2004/07/09 18:49:57     1.26
+++ src/sbin/reboot/reboot.c    2006/04/04 14:12:19
@@ -172,7 +172,7 @@
        if (access(_PATH_RC, R_OK) != -1) {
                pid_t pid;
                struct termios t;
-               int fd;
+               int fd, status;

                switch ((pid = fork())) {
                case -1:
@@ -199,7 +199,9 @@
                        execl(_PATH_BSHELL, "sh", _PATH_RC, "shutdown", (char *)NULL);
                        _exit(1);
                default:
-                       waitpid(pid, NULL, 0);
+                       waitpid(pid, &status, 0);
+                       if (WIFEXITED(status) && WEXITSTATUS(status) == 2)
+                               howto |= RB_POWERDOWN;
                }
        }



Visit your host, monkey.org