Commit Graph

158 Commits

Author SHA1 Message Date
Marek Polacek 9b59ecf082 vipw: use EXIT_* and err()
[kzak@redhat.com: - fix one error message]

Signed-off-by: Marek Polacek <mmpolacek@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-12-10 15:57:17 +01:00
Marek Polacek 84228d125e simpleinit: Use EXIT_*
[kzak@redhat.com: use the main() part of the patch]

Signed-off-by: Karel Zak <kzak@redhat.com>
2010-12-10 15:52:44 +01:00
Marek Polacek 713e0eeed4 shutdown: Use EXIT_*
Signed-off-by: Marek Polacek <mmpolacek@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-12-10 15:48:21 +01:00
Karel Zak 11784a8442 login: fix "ignoring return value" errors
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>
2010-12-10 14:05:27 +01:00
Marek Polacek 66020e56d2 login: use EXIT_* and err.h, clean up return codes
[kzak@redhat.com: - cleanup return codes
                  - use warn()]

Signed-off-by: Marek Polacek <mmpolacek@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-12-10 13:52:37 +01:00
Marek Polacek db797f24f1 last: Use EXIT_* and err()
Signed-off-by: Marek Polacek <mmpolacek@gmail.com>
2010-12-10 13:18:12 +01:00
Karel Zak 3851ebe8f8 login: use EXIT_* in checktty()
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-12-10 13:08:33 +01:00
Karel Zak d39d4bf6f5 chsh: use EXIT_* and err.h
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-12-10 13:01:05 +01:00
Karel Zak ea6833c0aa build-sys: add mesg to .gitignore
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-12-02 18:07:57 +01:00
Marek Polacek 365210fc53 agetty: Use EXIT_* and add noreturn attribute
Signed-off-by: Marek Polacek <mmpolacek@gmail.com>
2010-12-02 18:07:07 +01:00
Marek Polacek 1a68fc8aef mesg: Use EXIT_* and discard K&R style declaration.
[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>
2010-12-02 17:48:29 +01:00
Marek Polacek 1fa30199c6 newgrp: Use err() and EXIT_*
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>
2010-12-02 17:15:51 +01:00
Davidlohr Bueso eecb3c83ce last: use xalloc lib
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2010-11-30 13:18:18 +01:00
Davidlohr Bueso 3e31a2dfaf login: use xalloc lib
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2010-11-30 13:18:18 +01:00
Davidlohr Bueso 4b5156cbfa wall: use xalloc lib
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2010-11-30 13:18:18 +01:00
Karel Zak 601d12fb10 rename util-linux-ng back to util-linux
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-11-30 11:41:59 +01:00
Davidlohr Bueso 8abcf29002 lib: [strutils] general purpose string handling functions
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>
2010-11-23 21:06:49 +01:00
Karel Zak efcf9a9d1e agetty: use nl_langinfo()
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-11-15 16:48:27 +01:00
Marek Polacek 50644ff4de use _exit() instead of exit() in sighandlers
Signed-off-by: Marek Polacek <mmpolacek@gmail.com>
2010-10-29 13:26:25 +02:00
Karel Zak e98f4af950 agetty: fix -s option (baud rate setup)
The problem is pretty visible in strace output:

broken version:
  ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {B115200 opost isig icanon echo ...}) = 0
  [...]
  ioctl(0, SNDCTL_TMR_START or TCSETS, {B0 -opost -isig -icanon -echo ...}) = 0
                                       ^^^
fixed version:
  ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {B115200 opost isig icanon echo ...}) = 0
  [...]
  ioctl(0, SNDCTL_TMR_START or TCSETS, {B115200 -opost -isig -icanon -echo ...}) = 0

Reported-by: Jon Masters <jcm@redhat.com>
Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=645640
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-10-26 23:31:57 +02:00
Karel Zak bb1eea0ee0 agetty: add -c to reuse cflags
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>
2010-08-18 09:38:49 +02:00
Karel Zak e143d1f004 aggety: don't wipe CLOCAL flag
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>
2010-08-18 09:38:49 +02:00
Karel Zak 848e5e6ce3 agetty: add -s to reuse existing baud rate
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>
2010-08-18 09:35:42 +02:00
Karel Zak ae7054723b chsh: don't suggest ypchsh
$ 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>
2010-07-29 16:08:20 +02:00
Benno Schulenberg d0bb6987a8 textual: fix typos, and rephrase some things for clarity
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2010-06-14 11:17:00 +02:00
Karel Zak 5dfc518c2e build-sys: replace ../ with $top_srcdir
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-05-24 12:37:12 +02:00
Karel Zak 8bee984a93 login: check that after tty reopen we still work with a terminal
* 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>
2010-01-28 16:25:52 +01:00
Yann Droneaud 453b36147b login: use fd instead of pathname for update tty's owner and permissions
To avoid some nasty races, use the only true tty:
the one already opened, don't use the path.

Signed-off-by: Yann Droneaud <yann@droneaud.fr>
2010-01-28 15:24:38 +01:00
Karel Zak a43c6fc90d login: don't link PAMed version with libcrypt
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>
2010-01-27 13:31:16 +01:00
Karel Zak 8e5cf69f9e last: fix utmp.ut_time usage
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>
2009-11-20 14:46:32 +01:00
Karel Zak 23387a68a7 initctl: fix strict-aliasing bugs
Signed-off-by: Karel Zak <kzak@redhat.com>
2009-10-17 00:19:23 +02:00
Karel Zak ad564eadf9 newgrp: use c.h, remove tailing whitespace
Signed-off-by: Karel Zak <kzak@redhat.com>
2009-10-16 01:38:29 +02:00
Guillem Jover cef0ccd580 Remove now unused <sys/ioctl.h> includes
Those became unused with the switch to the blkdev functions.

Signed-off-by: Guillem Jover <guillem@hadrons.org>
2009-10-09 15:17:54 +02:00
Daniel Mierswa 437fa54f05 replace usleep() for systems that don't have them
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>
2009-08-21 09:58:17 +02:00
Peter Breitenlohner dc21efac31 simpleinit.8: formatting
Signed-off-by: Peter Breitenlohner <peb@mppmu.mpg.de>
2009-08-17 12:11:11 +02:00
Peter Breitenlohner ac4aadf973 shutdown.8: formatting
Signed-off-by: Peter Breitenlohner <peb@mppmu.mpg.de>
2009-08-17 12:11:11 +02:00
Peter Breitenlohner c6447b6d14 newgrp.1: formatting
Signed-off-by: Peter Breitenlohner <peb@mppmu.mpg.de>
2009-08-17 12:11:11 +02:00
Peter Breitenlohner 8d6047001b mesg.1: formatting
Signed-off-by: Peter Breitenlohner <peb@mppmu.mpg.de>
2009-08-17 12:11:11 +02:00
Peter Breitenlohner dfa815f926 last.1: formatting
Signed-off-by: Peter Breitenlohner <peb@mppmu.mpg.de>
2009-08-17 12:11:10 +02:00
Peter Breitenlohner caab730c3f initctl.8: formatting
Signed-off-by: Peter Breitenlohner <peb@mppmu.mpg.de>
2009-08-17 12:11:10 +02:00
Peter Breitenlohner 2054a2b01c chsh.1: formatting
Signed-off-by: Peter Breitenlohner <peb@mppmu.mpg.de>
2009-08-17 12:11:10 +02:00
Peter Breitenlohner 3e1dd9e846 chfn.1: formatting
Signed-off-by: Peter Breitenlohner <peb@mppmu.mpg.de>
2009-08-17 12:11:10 +02:00
Peter Breitenlohner 2fd71e5283 vipw.8: remove erroneous empty line, formatting
Signed-off-by: Peter Breitenlohner <peb@mppmu.mpg.de>
2009-08-17 12:11:04 +02:00
Daniel Mierswa c0f19ccff7 replace bcopy,bzero,index and rindex
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>
2009-08-17 11:15:59 +02:00
Karel Zak 30688dde55 build-sys: rename to _execdir
The variable name "usrlibexecdir" is very confusing (because we have
/usr/libexec). The "exec" prefix is required for user-defined
directories, see

   http://www.gnu.org/software/hello/manual/automake/The-Two-Parts-of-Install.html#The-Two-Parts-of-Install

This patch renames all usr*execdir variables to usr*_execdir.

Signed-off-by: Karel Zak <kzak@redhat.com>
2009-07-04 01:23:41 +02:00
Karel Zak 6ed7a96dfb build-sys: fix exec/data install hooks
Signed-off-by: Karel Zak <kzak@redhat.com>
2009-07-04 00:55:56 +02:00
Karel Zak c74c0dafff include: clean up _PATH_DEV_* macros
Signed-off-by: Karel Zak <kzak@redhat.com>
2009-06-30 01:13:42 +02:00
Aurelien Jarno ee51904169 agetty: IUCLC and OLCUC are Linux extensions
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>
2009-04-23 15:43:42 +02:00
Karel Zak 3c0e680cc2 login: use open(2) rather then access(2) for $HOME/.hushlogin
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>
2009-04-10 11:15:10 +02:00
Karel Zak 067f5343c8 login: use "remote" as a PAM service name for "login -h"
Signed-off-by: Karel Zak <kzak@redhat.com>
2009-03-17 21:00:42 +01:00