Re: [PATCH 9/9] agetty: fix invalid usage crash

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

 



On Mon, Jul 31, 2017 at 08:55:08PM +0100, Sami Kerola wrote:
> $ agetty
> agetty: not enough arguments: Success
> Segmentation fault (core dumped)
> 
> Reference: 9325dbfd2018b2a3b510617f4aa13777fbbe23c3
> Signed-off-by: Sami Kerola <kerolasa@xxxxxx>
> ---
>  term-utils/agetty.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/term-utils/agetty.c b/term-utils/agetty.c
> index f06b9fc6e..d9e9548fa 100644
> --- a/term-utils/agetty.c
> +++ b/term-utils/agetty.c
> @@ -803,7 +803,8 @@ static void parse_args(int argc, char **argv, struct options *op)
>  
>  	if (argc < optind + 1) {
>  		log_warn(_("not enough arguments"));
> -		warn(_("not enough arguments"));
> +		warnx(_("not enough arguments"));
> +		errtryhelp(EXIT_FAILURE);
>  	}
>  
>  	/* Accept "tty", "baudrate tty", and "tty baudrate". */
> @@ -812,7 +813,8 @@ static void parse_args(int argc, char **argv, struct options *op)
>  		parse_speeds(op, argv[optind++]);
>  		if (argc < optind + 1) {
>  			log_warn(_("not enough arguments"));
> -			warn(_("not enough arguments"));
> +			warnx(_("not enough arguments"));
> +			exit(EXIT_FAILURE);

what about:

            errx(EXIT_FAILURE, _("not enough arguments"));

   Karel

-- 
 Karel Zak  <kzak@xxxxxxxxxx>
 http://karelzak.blogspot.com
--
To unsubscribe from this list: send the line "unsubscribe util-linux" 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