login.c:542:8: warning: ignoring return value of ‘fchown’, declared
with attribute warn_unused_result
login.c:1013:11: warning: ignoring return value of ‘fchown’, declared
with attribute warn_unused_result
login.c: In function ‘dolastlog’:
login.c:1452:7: warning: ignoring return value of ‘write’, declared
with attribute warn_unused_result
login.c: In function ‘motd’:
login.c:1391:7: warning: ignoring return value of ‘write’, declared
with attribute warn_unused_result
Signed-off-by: Karel Zak <kzak@redhat.com>
[kzak@redhat.com: - use return rather than exit() in main()
- more verbose error messages]
Signed-off-by: Marek Polacek <mmpolacek@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
Use err() or errx() where appropriate. Also use EXIT_* macros instead
of 0/1. All error messages shall start with lowercase.
Signed-off-by: Marek Polacek <mmpolacek@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
This patch replaces a few functions used throughout the source:
* Renames getnum (from schedutils) to strtol_or_err
* Moves strtosize (from lib/strtosize.c)
* Moves xstrncpy (from include/xstrncpy.h)
* Adds strnlen, strnchr and strndup if not available (remove it from libmount utils)
A few Makefile.am files were modified to compile accordingly along with trivial renaming
in schedutils source code.
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
The agetty command resets terminal cflags setting. The -c option
disables this behavior and serial setting from kernel is used.
Signed-off-by: Karel Zak <kzak@redhat.com>
gettey should not clear the flag. It seems that the flag is
automatically enabled for serial consoles tht don't use CD signal.
Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=598631
Signed-off-by: Karel Zak <kzak@redhat.com>
For example:
/sbin/agetty -s /dev/ttyS0 9600
will reuse the speed the kernel configured on the port. If the setting
from kernel is useless (tty returns BREAK character) then the baud
rate from command line (9600) is used.
Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=623685
Signed-off-by: Karel Zak <kzak@redhat.com>
$ chsh
chsh: can only change local entries; use ypchsh instead.
The 'ypchsh' is an external util that does not have to be installed.
Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=497329
Signed-off-by: Karel Zak <kzak@redhat.com>
* the login code assumes that stdin is a terminal, it's better to
check (by isatty()) that after tty reopen we still have a terminal
* this patch also removes very old obscure fallback for situations where
ttyname() returns nothing (then ttyn = "/dev/tty??"). I guess that the
fake string was originally for utmp records or so. Currently (in last 10
years...) code requires that the tty name is a real open-able file.
It means the fake tty name is completely useless.
Reported-by: Yann Droneaud <yann@droneaud.fr>
Signed-off-by: Karel Zak <kzak@redhat.com>
The login, chsh and chfn utils don't need to be linked against libcrypt.
The libcrypt library is necessary only when login utils are not liked
with PAM.
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=559196
Signed-off-by: Karel Zak <kzak@redhat.com>
The utmp.ut_time is timeval.tv_sec (time_t) or int32_t. It's more
robust not to use ctime() or time() directly.
Signed-off-by: Karel Zak <kzak@redhat.com>
This function is marked obsolete in POSIX.1-2001 and removed in
POSIX.1-2008.
Conditionally replaced with nanosleep().
Signed-off-by: Daniel Mierswa <impulze@impulze.org>
Those 4 functions are marked as LEGACY in POSIX.1-2001 and removed in
POSIX.1-2008.
Replaced with memmove,memset,strchr and strrchr.
Signed-off-by: Daniel Mierswa <impulze@impulze.org>
IUCLC and OLCUC are Linux extensions to termios. The same way it is
already done for XCASE, they can be ignored if not supported.
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
As an NFS client with home directories on mounted NFS share - If the
NFS server exports the share with default root squashed, login cannot
access the filesystem to check for the existence of .hushlogin file.
It seems better to use open(2) rather than access(2).
Signed-off-by: Karel Zak <kzak@redhat.com>