libmount: fix "already mounted" detection on systems with mtab

For systems with regular mtab the fs->root should be ignored in
"already mounted" heuristic.

Reported-by: Matt Burgess <matthew@linuxfromscratch.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
fstab.5: fix misspelling of deprecated

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
sulogin: initial import from sysvinit

Import the source and manpage of sulogin. Only the selinux #ifdef is
changed to match our autotool setup.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
sulogin.8: refactor manpage

- Use a more standard layout using .IP macros for options
- Avoid direct references to sysvinit

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
sulogin: whitespace fixes

Use a code style more inline with the rest of the project.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
sulogin: replace older signal() with sigaction()

This provides a more reliable means of saving and restoring signal
handlers and avoids ugly (invalid) function pointer assignments. This
also removes the #ifdef blocking usage of a GCC attribute, which is
widely used in the rest of the codebase.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
sulogin: remove CHECK_{DES,MD5} defines

Remove these always-true defines along with their #ifdef statements.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
sulogin: remove USE_ONELINE and SANE_TIO defines

This was only ever compiled in for a single distro, with no clear
indication of why.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
sulogin: use size_t for iterator to avoid cast

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
sulogin: get rid of calls to /bin/sash

This probably doesn't exist on most systems, and if the root's shell and
/bin/sh fail to execute, it seems unlikely that /bin/sash will save us.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
sulogin: use pathnames.h for file locations

This covers /etc/shadow and /etc/passwd. We don't have a define for
/bin/sh -- just replace the macro with the hardcoded string as done
elsewhere.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
sulogin: header/include cleanup

- use our own crypt.h compile time check
- remove ttydefaults.h include -- get this via termios.h, the same as
  agetty

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
sulogin: use a more standard usage output

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
sulogin: add i18n strings

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
sulogin: cleanup comments

Signed-off-by: Karel Zak <kzak@redhat.com>
sulogin: replace perror() with warx()

Signed-off-by: Karel Zak <kzak@redhat.com>
sulogin: use err.h stuff

 and print "Login incorrect" to stderr like login(1).

Signed-off-by: Karel Zak <kzak@redhat.com>
sulogin: use EXIT_*

Signed-off-by: Karel Zak <kzak@redhat.com>
sulogin: add long options

Signed-off-by: Karel Zak <kzak@redhat.com>
sulogin: check chdir and getcwd return values [-Wunused-result]

sulogin.c: In function ‘sushell’:
sulogin.c:338:7: warning: ignoring return value of ‘chdir’, declared
with attribute warn_unused_result [-Wunused-result]
sulogin.c:359:8: warning: ignoring return value of ‘getcwd’, declared
with attribute warn_unused_result [-Wunused-result]

Signed-off-by: Karel Zak <kzak@redhat.com>