Re: [PATCH] Don't attempt to power off if power off is not implemented.

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

 



Hi!

> diff --git a/kernel/sys.c b/kernel/sys.c
> index bce933e..bf5842f 100644
> --- a/kernel/sys.c
> +++ b/kernel/sys.c
> @@ -488,6 +488,12 @@ asmlinkage long sys_reboot(int magic1, i
>  	                magic2 != LINUX_REBOOT_MAGIC2C))
>  		return -EINVAL;
>  
> +	/* Instead of trying to make the power_off code look like
> +	 * halt when pm_power_off is not set do it the easy way.
> +	 */
> +	if ((cmd == LINUX_REBOOT_CMD_POWER_OFF) && !pm_power_off)
> +		cmd = LINUX_REBOOT_CMD_HALT;
> +
>  	lock_kernel();
>  	switch (cmd) {
>  	case LINUX_REBOOT_CMD_RESTART:

Would not it be better to return -EPERM here or something like that?
That way userspace can decide that it really wants reboot or something
else.

								Pavel
-- 
Thanks, Sharp!
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux