Re: [PATCH] ctrlaltdel: Use err() instead of fprintf() and exit()

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

 



On Sun, 2010-10-17 at 11:01 +0200, Marek Polacek wrote:
> The patch I've send is probably broken because of missing newline.  Here
> is fixed version.

In case of failure, err() already displays the last component of the
program name.  A more explanatory error message would also be useful:

> Signed-off-by: Marek Polacek <mmpolacek@xxxxxxxxx>
> ---
>  sys-utils/ctrlaltdel.c |   45 ++++++++++++++++-----------------------------
>  1 files changed, 16 insertions(+), 29 deletions(-)
> 
> diff --git a/sys-utils/ctrlaltdel.c b/sys-utils/ctrlaltdel.c
> index beabc60..76b0048 100644
> --- a/sys-utils/ctrlaltdel.c
> +++ b/sys-utils/ctrlaltdel.c

[snip] 

> +	if (argc == 2 && !strcmp("hard", argv[1])) {
> +		if (my_reboot(LINUX_REBOOT_CMD_CAD_ON) < 0)
> +			err(EXIT_FAILURE, "ctrlaltdel: reboot");

                          err(EXIT_FAILURE, "reboot(CAD_ON)");

> +	} else if (argc == 2 && !strcmp("soft", argv[1])) {
> +		if (my_reboot(LINUX_REBOOT_CMD_CAD_OFF) < 0)
> +			err(EXIT_FAILURE, "ctrlaltdel: reboot");

                          err(EXIT_FAILURE, "reboot(CAD_OFF)");

-- Lawrence Rust


--
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux