projects
/
oweals
/
busybox.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Small size optimization from Aaron Lehmann
[oweals/busybox.git]
/
poweroff.c
diff --git
a/poweroff.c
b/poweroff.c
index 126a0fb9496e81fc08c8079127a7bc7a2714f0fb..8bb20e9bbb949ef5a1159896c9de61ffa777fc0d 100644
(file)
--- a/
poweroff.c
+++ b/
poweroff.c
@@
-21,14
+21,17
@@
*
*/
*
*/
-#include "
internal
.h"
+#include "
busybox
.h"
#include <signal.h>
extern int poweroff_main(int argc, char **argv)
{
#ifdef BB_FEATURE_LINUXRC
/* don't assume init's pid == 1 */
#include <signal.h>
extern int poweroff_main(int argc, char **argv)
{
#ifdef BB_FEATURE_LINUXRC
/* don't assume init's pid == 1 */
- return(kill(*(findPidByName("init")), SIGUSR2));
+ pid_t *pid = find_pid_by_name("init");
+ if (!pid || *pid<=0)
+ error_msg_and_die("no process killed");
+ return(kill(*pid, SIGUSR2));
#else
return(kill(1, SIGUSR2));
#endif
#else
return(kill(1, SIGUSR2));
#endif