libuuid: add extern qualifiers to uuid/uuid.h system header

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
include: simplify fputc_careful() in carefulputc.h

New version of comparisions does the same thing as the old without being
quite as difficult to understand.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
lib: remove xgetpass()

This function is not in use, and it has reference to obsoleted getpass().

Reference: http://man7.org/linux/man-pages/man3/getpass.3.html
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
last: make is_phantom() when kernel config does not include audit support

When kernel CONFIG_AUDIT is not set the /proc/<pid>/loginuid information
is not present resulting live sessions to be marked 'gone - no logout' in
last(1) print out.  To go-around this change makes last(1) to look
/dev/<tty> device ownership as a substitute of loginuid.

The go-around seems to work fairly well, but it has it short comings.
For example after closing a X window session the /dev/ttyN file seems to
be owned by root, not the user who had it before entering to the X
session.  While that is suboptimal it is still better than an attmempt to
determine uid_t by looking owner of the /proc/<struct utmp ut_pid>, that
is a login(1) process running as root.

The issue was found using Archlinux installation.

$ pacman -Qi linux
Name           : linux
Version        : 3.16-2
[...]
Build Date     : Mon Aug 4 18:06:51 2014

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
last: improve code readability by renaming variable names

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
mountpoint: add struct mountpoint_control

This unifies variable names in different functions, and removes redundant
stat() calls.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
mkfs.minix: fix couple compiler warnings

disk-utils/mkfs.minix.c:366:3: warning: ISO C forbids 'return' with
expression, in function returning void [-Wpedantic]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
mountpoint: simplify if statement

Returning straight after print_devno() makes the code to be more obvious
and removes need for long else statement.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
eject: add struct eject_control to remove global variables

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
eject: make open_device() and select_speed() to use struct eject_control

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
hwclock: remove referal to deprecated keyboard interface

The KDGHWCLK has been gone quite a while.

Reference: http://marc.info/?l=linux-kernel&m=104171103925897
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
setarch: reindent code

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
setarch: use personality() system call when it is available

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
newgrp: use libc function to read gshadow if it is available

The glib versionf of getsgnam() is using /etc/nsswitch.conf, allowing the
group passwords to come from external database.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
newgrp: avoid use of obsolete getpass() function

Read a password from user with termios, and once the password data is no
longer needed ensure it gets overwrote before unallocating memory.

Reference: http://man7.org/linux/man-pages/man3/getpass.3.html
Reference: https://www.securecoding.cert.org/confluence/display/seccode/MSC06-C.+Beware+of+compiler+optimizations
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
textual: share crypt() error message in sulogin and newgrp

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
renice: reorder functions to avoid need of function prototype

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
rename: use usage and version print out macros

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
renice: disallow --priority <arg> without pid argument

Earlier a lonely priority with an argument but without pid resulted to no
action and success, when the invocation should have failed.

$ renice --priority 42 ; echo $?
0

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
renice: avoid having same lines of code twice

Add getprio() function to avoid duplication of a simple task.

Reviewed-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>