Re: [PATCH 4/4] agetty: cleanup usage issues

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

 



On Monday 19 June 2017, Ruediger Meier wrote:
> From: Ruediger Meier <ruediger.meier@xxxxxxxxxxx>
>
> Fixed checkusage.sh warnings:
>   agetty: --unknownopt, stderr too long: 45
>
> Signed-off-by: Ruediger Meier <ruediger.meier@xxxxxxxxxxx>
> ---
>  term-utils/agetty.c | 102
> ++++++++++++++++++++++++++-------------------------- 1 file changed,
> 51 insertions(+), 51 deletions(-)
>
> diff --git a/term-utils/agetty.c b/term-utils/agetty.c
> index 938fa2f..542cbce 100644
> --- a/term-utils/agetty.c
> +++ b/term-utils/agetty.c
> @@ -308,7 +308,7 @@ static void termio_final(struct options *op,
>  			 struct termios *tp, struct chardata *cp);
>  static int caps_lock(char *s);
>  static speed_t bcode(char *s);
> -static void usage(FILE * out) __attribute__((__noreturn__));
> +static void usage(void) __attribute__((__noreturn__));
>  static void log_err(const char *, ...) __attribute__((__noreturn__))
>  			       __attribute__((__format__(printf, 1, 2)));
>  static void log_warn (const char *, ...)
> @@ -785,9 +785,9 @@ static void parse_args(int argc, char **argv,
> struct options *op) printf(UTIL_LINUX_VERSION);
>  			exit(EXIT_SUCCESS);
>  		case HELP_OPTION:
> -			usage(stdout);
> +			usage();
>  		default:
> -			usage(stderr);
> +			errtryhelp(EXIT_FAILURE);
>  		}
>  	}
>
> @@ -795,7 +795,7 @@ static void parse_args(int argc, char **argv,
> struct options *op)
>
>  	if (argc < optind + 1) {
>  		log_warn(_("not enough arguments"));
> -		usage(stderr);
> +		errtryhelp(EXIT_FAILURE);
>  	}

BTW here we print the real warning to syslog only. But a few lines below 
we have this
            warn(_("not enough arguments"));
            errtryhelp(EXIT_FAILURE);

Could somebody review this, I'm not sure when agetty is allowed to write 
to the terminal and when not. 

cu,
Rudi
--
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