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

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

 



On Tue, Jun 20, 2017 at 11:35:43AM +0200, Ruediger Meier wrote:
> >  	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. 

It's probably bad idea to use stdout/stdin/stderr before open_tty().
The file descriptors maybe open, but for sure it's better to rely on
open_tty().

For parse_args() it would be better to use log_* functions only. It
means that strtou32_or_err() and warnx() are bad idea.

For the --help and --version it's probably fine to use stdout.

    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