FreeBSD Bugzilla – Attachment 79401 Details for
Bug 114059
[patch] shutdown(8) should fall back to exec reboot/halt when init is not running
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 1.18 KB, created by
Stef Walter
on 2007-06-27 03:10:04 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
Stef Walter
Created:
2007-06-27 03:10:04 UTC
Size:
1.18 KB
patch
obsolete
>--- sbin/shutdown/shutdown.c.orig Wed Jun 27 01:41:11 2007 >+++ sbin/shutdown/shutdown.c Wed Jun 27 01:52:21 2007 >@@ -57,6 +57,7 @@ > #include <stdlib.h> > #include <string.h> > #include <unistd.h> >+#include <errno.h> > > #ifdef DEBUG > #undef _PATH_NOLOGIN >@@ -328,6 +329,7 @@ > die_you_gravy_sucking_pig_dog() > { > char *empty_environ[] = { NULL }; >+ int sig; > > syslog(LOG_NOTICE, "%s by %s: %s", > doreboot ? "reboot" : dohalt ? "halt" : dopower ? "power-down" : >@@ -351,11 +353,20 @@ > (void)printf("\nkill -HUP 1\n"); > #else > if (!oflag) { >- (void)kill(1, doreboot ? SIGINT : /* reboot */ >- dohalt ? SIGUSR1 : /* halt */ >- dopower ? SIGUSR2 : /* power-down */ >- SIGTERM); /* single-user */ >- } else { >+ sig = doreboot ? SIGINT : /* reboot */ >+ dohalt ? SIGUSR1 : /* halt */ >+ dopower ? SIGUSR2 : /* power-down */ >+ SIGTERM; /* single-user */ >+ >+ if (kill(1, sig) < 0) { >+ if (errno == ESRCH) >+ oflag = 1; /* try calling reboot */ >+ else >+ syslog(LOG_ERR, "shutdown: can't signal init (process 1): %m"); >+ } >+ } >+ >+ if (oflag) { > if (doreboot) { > execle(_PATH_REBOOT, "reboot", "-l", nosync, > (char *)NULL, empty_environ);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 114059
: 79401