Be extra extra careful about what we dereference.
This commit is contained in:
parent
d50a61956c
commit
332394b577
5
halt.c
5
halt.c
@ -28,7 +28,10 @@ extern int halt_main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
#ifdef BB_FEATURE_LINUXRC
|
#ifdef BB_FEATURE_LINUXRC
|
||||||
/* don't assume init's pid == 1 */
|
/* don't assume init's pid == 1 */
|
||||||
return(kill(*(find_pid_by_name("init")), SIGUSR1));
|
pid_t *pid = find_pid_by_name("init");
|
||||||
|
if (!pid || *pid<=0)
|
||||||
|
error_msg_and_die("no process killed");
|
||||||
|
return(kill(*pid, SIGUSR1));
|
||||||
#else
|
#else
|
||||||
return(kill(1, SIGUSR1));
|
return(kill(1, SIGUSR1));
|
||||||
#endif
|
#endif
|
||||||
|
@ -28,7 +28,10 @@ extern int halt_main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
#ifdef BB_FEATURE_LINUXRC
|
#ifdef BB_FEATURE_LINUXRC
|
||||||
/* don't assume init's pid == 1 */
|
/* don't assume init's pid == 1 */
|
||||||
return(kill(*(find_pid_by_name("init")), SIGUSR1));
|
pid_t *pid = find_pid_by_name("init");
|
||||||
|
if (!pid || *pid<=0)
|
||||||
|
error_msg_and_die("no process killed");
|
||||||
|
return(kill(*pid, SIGUSR1));
|
||||||
#else
|
#else
|
||||||
return(kill(1, SIGUSR1));
|
return(kill(1, SIGUSR1));
|
||||||
#endif
|
#endif
|
||||||
|
@ -28,7 +28,10 @@ extern int poweroff_main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
#ifdef BB_FEATURE_LINUXRC
|
#ifdef BB_FEATURE_LINUXRC
|
||||||
/* don't assume init's pid == 1 */
|
/* don't assume init's pid == 1 */
|
||||||
return(kill(*(find_pid_by_name("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
|
#else
|
||||||
return(kill(1, SIGUSR2));
|
return(kill(1, SIGUSR2));
|
||||||
#endif
|
#endif
|
||||||
|
@ -28,7 +28,10 @@ extern int reboot_main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
#ifdef BB_FEATURE_LINUXRC
|
#ifdef BB_FEATURE_LINUXRC
|
||||||
/* don't assume init's pid == 1 */
|
/* don't assume init's pid == 1 */
|
||||||
return(kill(*(find_pid_by_name("init")), SIGTERM));
|
pid_t *pid = find_pid_by_name("init");
|
||||||
|
if (!pid || *pid<=0)
|
||||||
|
error_msg_and_die("no process killed");
|
||||||
|
return(kill(*pid, SIGTERM));
|
||||||
#else
|
#else
|
||||||
return(kill(1, SIGTERM));
|
return(kill(1, SIGTERM));
|
||||||
#endif
|
#endif
|
||||||
|
@ -28,7 +28,10 @@ extern int poweroff_main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
#ifdef BB_FEATURE_LINUXRC
|
#ifdef BB_FEATURE_LINUXRC
|
||||||
/* don't assume init's pid == 1 */
|
/* don't assume init's pid == 1 */
|
||||||
return(kill(*(find_pid_by_name("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
|
#else
|
||||||
return(kill(1, SIGUSR2));
|
return(kill(1, SIGUSR2));
|
||||||
#endif
|
#endif
|
||||||
|
5
reboot.c
5
reboot.c
@ -28,7 +28,10 @@ extern int reboot_main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
#ifdef BB_FEATURE_LINUXRC
|
#ifdef BB_FEATURE_LINUXRC
|
||||||
/* don't assume init's pid == 1 */
|
/* don't assume init's pid == 1 */
|
||||||
return(kill(*(find_pid_by_name("init")), SIGTERM));
|
pid_t *pid = find_pid_by_name("init");
|
||||||
|
if (!pid || *pid<=0)
|
||||||
|
error_msg_and_die("no process killed");
|
||||||
|
return(kill(*pid, SIGTERM));
|
||||||
#else
|
#else
|
||||||
return(kill(1, SIGTERM));
|
return(kill(1, SIGTERM));
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user