Commit graph

31673 commits

Author SHA1 Message Date
Lennart Poettering e32fd6b47c sd-bus: when debug logging about messages, show the same bits of it everywhere
Also, include the message signature everywhere.
2018-01-05 13:55:08 +01:00
Lennart Poettering 665dfe9318 io-util: make flush_fd() return how many bytes where flushed
This is useful so that callers know whether anything at all and how much
was flushed.

This patches through users of this functions to ensure that the return
values > 0 which may be returned now are not propagated in public APIs.

Also, users that ignore the return value are changed to do so explicitly
now.
2018-01-05 13:55:08 +01:00
John Lin 7c59ab4ba1 install: search preset files in /run (#7715)
According to systemd.preset(5), presets files in /run should take
effect. However, before this patch, preset files in /run were
ignored.
2018-01-05 13:15:42 +01:00
Zbigniew Jędrzejewski-Szmek 5035800495
Merge pull request #7763 from yuwata/fix-7761
Revert "core/execute: RuntimeDirectory= or friends requires mount namespace"
2018-01-05 12:38:29 +01:00
Bruce A. Johnson 94d4acbe4b systemd-udevd: fix speed/duplex processing with valid .link files (#7808)
Including BitsPerSecond or Duplex values in .link files did not work when
set_slinksettings was called because the routine was not copying the base
parameters to the structure given to ioctl.  As a result, EINVAL was always
reported, and no change occurred on the Ethernet device.
2018-01-05 10:02:38 +01:00
Alexis Deruelle c559eecaad Touchpad range : add another Macbook4,1 variant (#7749)
#Add "Early 2008 Core 2 Duo/Penryn" Macbook4,1 match string to the existing touchpad range definition

##Symptoms
* Jerky/Jumpy cursor motion using touchpad
* "Axis value outside expected range" message in Xorg.0.log

##Fix
I followed the instructions described here :https://wayland.freedesktop.org/libinput/doc/latest/absolute_coordinate_ranges.html and came up with the following :

evdev:input:b0003v05ACp022A*
 EVDEV_ABS_00=256:1469:12
 EVDEV_ABS_01=256:829:12

The ranges and resolutions are the same as stated in the existing definition (+/- 2) so only add the match string.
2018-01-05 10:17:17 +10:00
Hans de Goede dd1d57b0d1 hwdb: Add accel mount settings for Asus T200TA 2-in-1 (#7810)
Add accel mount settings for the INVN6500 accelerometer found in
Asus T200TA 2-in-1 devices to 60-sensor.hwdb.
2018-01-04 19:43:27 +01:00
Zbigniew Jędrzejewski-Szmek bbc79ae5c9
Merge pull request #7767 from poettering/fork-wait
A variety of smaller improvements all over the place
2018-01-04 15:25:07 +01:00
Lennart Poettering 9ad45f460f
Merge pull request #7805 from keszybz/coverity-prep
Two small workarounds to help coverity
2018-01-04 15:20:29 +01:00
Lennart Poettering dd95b381b2 NEWS: add in a missing change back from 229 (#7804)
See:

https://lists.freedesktop.org/archives/systemd-devel/2017-July/039255.html
http://fromthecodefront.blogspot.de/2017/07/systemd-pitfalls.html
2018-01-04 13:52:50 +01:00
Zbigniew Jędrzejewski-Szmek 963c6c90af coverity: don't use (void)0 under coverity
I'm not sure why this is needed, but apparrently coverity doesn't like
(void)0. With this change, coverity can (almost) build systemd:

CFLAGS='-D_Float128="long double"' meson cov-build -Dman=false && \
  CCACHE_DISABLE=1 COVERITY_UNSUPPORTED=1 cov-build --dir cov-int ninja -C cov-build

Patch originially by Marek Cermak <macermak@redhat.com>.
2018-01-04 13:44:39 +01:00
Zbigniew Jędrzejewski-Szmek 14899e2ba3 test-routing-policy-rule: split out fd assignment from assert_se
It's ugly that parentheses need to be used. Let's just split it out.
Incidentally, this will make coverity happy, because it doesn't grok
assert_se().
2018-01-04 13:43:53 +01:00
Lennart Poettering 46099c9e36 update TODO 2018-01-04 13:28:24 +01:00
Lennart Poettering 99c61f6b00 fileio: minor tweak to executable_is_script()
If read_line() returns ENOBFUS this means the line was overly long. When
we use this for checking whether an executable is a script, then this
shouldn't be propagated as-is, but simply as "this is not a script".
2018-01-04 13:28:24 +01:00
Lennart Poettering 91dc2bf74d fileio: tweak write_string_stream_ts() to write out trailing \n in one go even if buffering is off
This tweaks write_string_stream_ts() in one minor way: when stdio
buffering has been turned off, let's append the newline we shall append
to the buffer we write ourselves so that the kernel only gets one
syscall for the result. When buffering is enabled stdio will take care
of that anyway.

Follow-up for #7750.
2018-01-04 13:28:24 +01:00
Lennart Poettering 3e641e361d sd-bus: port one use of SO_PEERCRED by getpeercred() 2018-01-04 13:28:24 +01:00
Lennart Poettering 86ed6d1b1f sd-bus: let's use mfree() where we can 2018-01-04 13:28:24 +01:00
Lennart Poettering 18ac4643cb sd-bus: use SO_PEERGROUPS when available to identify groups of peer 2018-01-04 13:28:24 +01:00
Lennart Poettering 2fce06b0d6 journald: introduce new uid_for_system_journal() helper
We use the same check at two places, let's add a tiny helper function
for it, since it's not entirely trivialy, and we changes this before
multiple times, and it's a good thing if we can change it at one place
only instead of multiple.
2018-01-04 13:28:24 +01:00
Lennart Poettering 217d896782 socket-util: slight rework of getpeersec()
Let's call getsockopt() in a loop, so that we can deal correctly with
the label changing while we are trying to read it.

(also, while we are at it, let's make sure that there's always one
trailing NUL byte at the end of the buffer, after all SO_PEERSEC has
zero documentation, and multiple implementing backends, hence let's
better be safe than sorry)
2018-01-04 13:28:24 +01:00
Lennart Poettering bbcc701ee7 tree-wide: use {pid,uid,gid}_is_valid() where appropriate
Also, drop UID/GID validity checks from getpeercred() as the kernel will
never pass us invalid UID/GID on userns, but the overflow UID/GID
instead. Add a comment about this.
2018-01-04 13:27:54 +01:00
Lennart Poettering 10e859a2f3 calenderspec: when normalizing, flush out UTC timezone 2018-01-04 13:27:27 +01:00
Lennart Poettering 2dc894541f user-util: minor updates of in_gid()
Let's use newa() and use the right type for storing sysconf() return
values.
2018-01-04 13:27:27 +01:00
Lennart Poettering 43f2c88df0 socket-util: add new getpeergroups() call
It's a wrapper around the new SO_PEERGROUPS sockopt, similar in style as
getpeersec() and getpeercred().
2018-01-04 13:27:27 +01:00
Lennart Poettering 5e9f01e8a6 tree-wide: in all threads we fork off in library code, block all signals
This ensures that in all threads we fork off in the background in our
code we mask out all signals, so that our thread won't end up getting
signals delivered the main process should be getting.

We always set the signal mask before forking off the thread, so that the
thread has the right mask set from its earliest existance on.
2018-01-04 13:27:27 +01:00
Lennart Poettering be39f6ee31 process-util: add new FORK_NEW_MOUNTNS flag to safe_fork()
That way we can move one more code location to use safe_fork()
2018-01-04 13:27:27 +01:00
Lennart Poettering 3f60395254 pager: let's move static variables up, to the rest of them
let's keep static variables together, and before the function
definitions.
2018-01-04 13:27:27 +01:00
Lennart Poettering 85afeae88c pager,agent: insist that we are called from the main thread
We maintain static process-wide variables in these subsystems without
locking, hence let's refuse operation unless we are called from the main
thread (which we do anyway) just as a safety precaution.
2018-01-04 13:27:27 +01:00
Lennart Poettering b4a343112e tree-wide: use EXIT_SUCCESS when comparing child process exit statuses
When we check the exit status of a subprocess, let's compare it with
EXIT_SUCCESS rather than 0 when looking for success.

This clarifies in code what kind of variable we are looking at and what
we are doing.
2018-01-04 13:27:27 +01:00
Lennart Poettering d2e0ac3d1e tree-wide: unify the process name we pass to wait_for_terminate_and_check() with the one we pass to safe_fork() 2018-01-04 13:27:27 +01:00
Lennart Poettering 2e87a1fde9 tree-wide: make use of wait_for_terminate_and_check() at various places
Using wait_for_terminate_and_check() instead of wait_for_terminate()
let's us simplify, shorten and unify the return value checking and
logging of waitid().  Hence, let's use it all over the place.
2018-01-04 13:27:27 +01:00
Lennart Poettering 1f5d1e0247 process-spec: add another flag FORK_WAIT to safe_fork()
This new flag will cause safe_fork() to wait for the forked off child
before returning. This allows us to unify a number of cases where we
immediately wait on the forked off child, witout running any code in the
parent after the fork, and without direct interest in the precise exit
status of the process, except recgonizing EXIT_SUCCESS vs everything
else.
2018-01-04 13:27:27 +01:00
Lennart Poettering 66fb11423b exec-util: drop redundant log message in do_spawn()
safe_fork() logs that anyway, hence no need to do this twice.
2018-01-04 13:27:27 +01:00
Lennart Poettering 7d4904fe7a process-util: rework wait_for_terminate_and_warn() to take a flags parameter
This renames wait_for_terminate_and_warn() to
wait_for_terminate_and_check(), and adds a flags parameter, that
controls how much to log: there's one flag that means we log about
abnormal stuff, and another one that controls whether we log about
non-zero exit codes. Finally, there's a shortcut flag value for logging
in both cases, as that's what we usually use.

All callers are accordingly updated. At three occasions duplicate logging
is removed, i.e. where the old function was called but logged in the
caller, too.
2018-01-04 13:27:27 +01:00
Lennart Poettering b6e1fff13d process-util: add another fork_safe() flag for enabling LOG_ERR/LOG_WARN logging 2018-01-04 13:27:26 +01:00
Lennart Poettering 799a960d1f raw-clone: beef up raw_clone() wrapper a bit
First of all, let's return pid_t, which appears to be the correct type
given that we return PIDs, and it#s what fork() uses too.

Most importantly though, flush out our PID cache, so that the call
becomes compatible with our getpid_cached() logic.
2018-01-04 13:27:26 +01:00
Lennart Poettering 3139096321 vconsole-setup: add some void casts 2018-01-04 13:27:26 +01:00
Lennart Poettering 8ed7742aa2 ip-address-access: let's exit the loop after invalidating our entry a (#7803)
CID#1382967
2018-01-04 13:24:40 +01:00
Mike Gilbert 2fa645f1cc meson: don't search PATH for telinit (#7770)
On a typical system running systemd, the telinit in PATH is very likely to be a symlink
to systemctl. Setting TELINIT to this may result in an infinite recursion if telinit is called
and sd_booted() == 0. This may commonly occur in a chroot environment.

Bug: https://bugs.gentoo.org/642724

[zj:
The path was originally hardcoded as "/lib/upstart/telinit", but was made configurable without
changing the default in 4ad61fd180. Then the default was
changed to `/lib/sysvinit/telinit` in abaaabf40a. Then it
started being  autodetected when meson support was added in 
5c23128dab. This patch restores the behaviour that was 
implemented in configure.ac at the time of its removal.]
2018-01-04 13:14:20 +01:00
Lennart Poettering 3046b6db1d
main: don't bother with the return value of invoke_mainloop() (#7802)
We don't use the return value, and we don't have to, as the call already
initializes &ret, which is the one we return as exit code from the
process.

CID#1384230
2018-01-04 12:55:21 +01:00
Lennart Poettering 3282774050
Merge pull request #7801 from keszybz/docs-and-coverity
Docs and coverity
2018-01-04 12:38:27 +01:00
Shawn Landden 7ddc2dc5e6 fix machinectl shell (in machined) (#7785)
4c253ed broke machined
$machinectl shell arch
Failed to get shell PTY: Input/output error

Closes: #7779

v2: do not drop DEATHSIG flag
2018-01-04 12:37:15 +01:00
Zbigniew Jędrzejewski-Szmek 97149f405c core: fix mac_selinux_setup return value check
Introduced in 74da609f0d. CID #1384210.
2018-01-04 11:31:37 +01:00
Zbigniew Jędrzejewski-Szmek 1330648562 core: double free in bus_timer_set_transient_property
Introduced in 3e3c5a4571. CID #1384233.
2018-01-04 11:31:37 +01:00
Zbigniew Jędrzejewski-Szmek 1893972894 run: double free
Introduced in f2b9f2c83e. CID #1384218.
2018-01-04 11:31:30 +01:00
Zbigniew Jędrzejewski-Szmek 85f8fa4dee test-sizeof: also add uid_t
We had gid_t, and pid_t, but not uid_t. Add for completeness.
2018-01-04 11:16:19 +01:00
Zbigniew Jędrzejewski-Szmek 7f8b3d1d32 man: drop --arch from debootstrap invocation
Nowadays people use systemd on many different architectures, so we
shouldn't presuppose that they are using amd64. debootstrap defaults
to the native architecture and this should be good enough.
2018-01-04 11:16:19 +01:00
Patrik Flykt 7ac6c26a22 dhcp6: Fix DHCPv6 client file descriptor and event handling (#7796)
Close DHCPv6 client socket file descriptor when
sd_dhcp6_client_stop() is called and not when client_reset() is
called. If left in client_reset(), any internal temporary stopping
of the DHCPv6 client with client_stop() will call client_reset()
after which the DHCPv6 client will not be able to receive any further
DHCPv6 messages.

Similarly, client_start() needs to enable events for the DHCPv6
socket file descriptor since a call to client_stop() will call
client_reset() which will remove it from the main loop. Events should
be turned off when no DHCPv6 messages are expected.
2018-01-04 11:02:52 +01:00
George G 0ceced3d9a README: EXT4_POSIX_ACL -> EXT4_FS_POSIX_ACL (#7799)
EXT4_POSIX_ACL doesn't exist.
2018-01-04 08:53:44 +01:00
Lennart Poettering 4ab02a0d36
Merge pull request #7793 from rojkov/fix-6456
resolved: fix refcounting DnsScope's conflict_queue
2018-01-03 18:43:14 +01:00