Karel Zak [Thu, 7 Sep 2017 12:19:20 +0000 (14:19 +0200)]
su: (pty) improve SIGSTOP/SIGCONT semantic
We want to use waitpid() only when child is terminated or stopped to
pick up child status, otherwise PTY proxy has to be active. This is
difference between "su" and "su --pty". For "su" we keep parent all
time in waitpid().
It would be possible to use separate code based on signalfd_siginfo,
but it seems better to keep all this stuff on one place -- it means
wait_for_child().
Sami Kerola [Sun, 27 Aug 2017 20:25:03 +0000 (21:25 +0100)]
runuser: fix linking
Add conditional -lutil to runuser when needed to avoid linking error.
login-utils/su-common.o: In function `pty_create':
login-utils/su-common.c:269: undefined reference to `openpty'
login-utils/su-common.c:273: undefined reference to `openpty'
Karel Zak [Fri, 11 Aug 2017 15:05:00 +0000 (17:05 +0200)]
su: unblock signals is all initialized
This patch a little bit reorders signals initialization. The original
code unblocks SIGINT SIGQUIT before signal handler is set for the
signals. It means there is a small possible race.
It seems better to compose wanted mask, setup handlers and then
unblock all the wanted signals.
Karel Zak [Fri, 15 Sep 2017 12:30:06 +0000 (14:30 +0200)]
libmount: export locking errors as MNT_EX_FILEIO
The mount man page assumes locking errors mapped to MNT_EX_FILEIO (16)
return code. Unfortunately, this is internally not exported as a
special error code, so it's returned as a generic (errno based)
stuff. This patch fixes this issue.
Note that we still use locking for example for utab or when enabled
/etc/mtab (disabled by default).
Sami Kerola [Mon, 11 Sep 2017 19:55:58 +0000 (20:55 +0100)]
rfkill: do not fsync(3) /dev/rfkill file descriptor
Attempt to fsync() this device returns EINVAL, causing the rfkill always to
return EXIT_FAILURE when either block or unblock is requested. Simply
closing the file descriptor will fix the issue.
Sami Kerola [Mon, 11 Sep 2017 19:55:57 +0000 (20:55 +0100)]
rfkill: allow use of multiple arguments
There is no reason why multiple arguments could not be supported.
Most common use case is to do multiple control commands in one go without us
of 'all' argument that can cause unnecessary connection breakage. For
example someone might want to add to a system initialization following
commands.
rfkill block bluetooth uwb wimax wwan gps fm nfc
That will ensure everything but wifi is turned off with as few commands as
possible, without killing wifi at any point.
Karel Zak [Fri, 8 Sep 2017 07:48:29 +0000 (09:48 +0200)]
script: support sig{stop/cont}
* call wait() only when child exited
* suspend all session (including script master process) when child get
SIGSTOP and send SIGCONT to child when master process resume
This allows to suspend all session and later use "fg" shell command to
resume.
Karel Zak [Thu, 31 Aug 2017 12:47:14 +0000 (14:47 +0200)]
wipefs: cleanup offsets list usage, fix -t filter
* move list with offsets specified by -o to the wipe_control struct
* don't clone the list of offsets, just keep it simple and stupid
* apply all filters (-o and -t) in get_desc_for_probe()
* always return offset and len by get_desc_for_probe() and apply
always use libblkid hide & step-back
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1486777 Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Thu, 31 Aug 2017 07:56:18 +0000 (09:56 +0200)]
Merge branch 'rfkill' of git://github.com/kerolasa/lelux-utiliteetit into rfkill
* 'rfkill' of git://github.com/kerolasa/lelux-utiliteetit: (57 commits)
rfkill: add systemd-rfkill(8) see also segment
rfkill: check id number refers to a device that exists
rfkill: use back and forward compatible test
rfkill: add bash-completion file
rfkill: inform in syslog when rfkill is invoked
rfkill: use human readable timestamps in event output
rfkill: use libsmartcols output
rfkill: do not ignore read error
rfkill: clarify 'all devices' handling
rfkill: update manual page
rfkill: make programming style to match util-linux project
rfkill: make command to build in util-linux project
rfkill: move files to appropriate locations
add python module
use uapi rfkill.h
version 0.5
fix compiler warning
Add NFC support
version 0.4
Add rfkill type "fm" to the man page.
...
Sami Kerola [Sun, 25 Jun 2017 11:12:40 +0000 (12:12 +0100)]
rfkill: inform in syslog when rfkill is invoked
This should help when trying to explain what or who is flicking wireles on
or off. Notice that the change is not perfect - if rfkill command is
setting a state that is already set the syslog entry is sent eventhough
there was no effective change.
Sami Kerola [Sun, 25 Jun 2017 00:35:28 +0000 (01:35 +0100)]
rfkill: do not ignore read error
Read error should be impossible, but when one does happen user certainly
wants to know about that rather than see even more strange issue caused
random data in name variable.
Sami Kerola [Sun, 25 Jun 2017 00:04:41 +0000 (01:04 +0100)]
rfkill: clarify 'all devices' handling
Stop using RFKILL_IS_INVALID a marker when rfkill is iterating over all
devices. Addition of RFKIL_IS_ALL should make this a lot easier to digest,
especially if reading code in hurry.
Sami Kerola [Sat, 24 Jun 2017 19:42:58 +0000 (20:42 +0100)]
rfkill: make programming style to match util-linux project
Use the usual facilities, add translation strings, move global variables at
the beginning of the file, make usage() look as expected, add standard
command-line option parsing.
Sami Kerola [Wed, 30 Aug 2017 19:29:31 +0000 (20:29 +0100)]
rfkill: merge rfkill.8 project to util-linux
Projet merge discussion in maillists:
http://www.spinics.net/lists/util-linux-ng/msg14289.html
http://marc.info/?l=linux-wireless&m=149880885914076&w=2
Old-Remote: http://git.sipsolutions.net/rfkill.git/
Old-Remote: git://git.kernel.org/pub/scm/linux/kernel/git/jberg/rfkill.git Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Sami Kerola [Sat, 26 Aug 2017 12:38:07 +0000 (13:38 +0100)]
hwclock: remove bool type definition
Use plain int instead of type defining it to a boolean, and use numbers to
signify true or false as we do everywhere else in this source tree. And in
hwclock-cmos.c file booleans weren't even needed, to the related code is
removed.