summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2018-07-19 12:42:40 -0400
committerLuke Shumaker <lukeshu@lukeshu.com>2018-07-19 12:42:40 -0400
commitc9bb7ae80d1a888cd717c891f4be1b7f3030772f (patch)
tree1026f5da3924302c3d2d4cbcc36e81125b121123
parent021fdbe02956e745b579f49fc0585747c2aec458 (diff)
parentd376c0dea6172ab88fcb21643092228e3f415950 (diff)
Merge tag 'systemd/v238.76-1.parabola1' into systemd/parabola
-rw-r--r--NEWS6
-rw-r--r--README11
-rw-r--r--README.md2
-rw-r--r--hwdb/60-evdev.hwdb38
-rw-r--r--hwdb/60-keyboard.hwdb21
-rw-r--r--hwdb/60-sensor.hwdb10
-rw-r--r--man/hostnamectl.xml9
-rw-r--r--man/localectl.xml8
-rw-r--r--man/machinectl.xml8
-rw-r--r--man/systemd-nspawn.xml6
-rw-r--r--man/systemd-tmpfiles.xml12
-rw-r--r--man/timedatectl.xml5
-rw-r--r--meson.build7
-rw-r--r--shell-completion/bash/busctl15
-rw-r--r--shell-completion/zsh/_systemd-analyze3
-rw-r--r--src/basic/calendarspec.c6
-rw-r--r--src/basic/cgroup-util.c1
-rw-r--r--src/basic/fd-util.h4
-rwxr-xr-xsrc/basic/generate-af-list.sh2
-rw-r--r--src/basic/log.c4
-rw-r--r--src/basic/log.h4
-rw-r--r--src/basic/macro.h19
-rw-r--r--src/basic/process-util.c2
-rw-r--r--src/basic/process-util.h2
-rw-r--r--src/basic/stat-util.c3
-rw-r--r--src/busctl/busctl.c5
-rw-r--r--src/core/cgroup.c25
-rw-r--r--src/core/dbus-execute.c1
-rw-r--r--src/core/load-fragment.c12
-rw-r--r--src/core/macros.systemd.in12
-rw-r--r--src/core/main.c4
-rw-r--r--src/core/manager.h3
-rw-r--r--src/core/mount.c2
-rw-r--r--src/core/triggers.systemd.in12
-rw-r--r--src/core/umount.c4
-rw-r--r--src/core/unit.c7
-rw-r--r--src/journal-remote/meson.build4
-rw-r--r--src/journal/journal-file.c2
-rw-r--r--src/journal/journal-verify.c2
-rw-r--r--src/journal/test-journal-interleaving.c2
-rw-r--r--src/libsystemd/sd-bus/bus-socket.c5
-rw-r--r--src/login/inhibit.c3
-rw-r--r--src/network/networkd-manager.c2
-rw-r--r--src/nspawn/nspawn.c32
-rw-r--r--src/resolve/resolve-tool.c6
-rw-r--r--src/shared/machine-image.c9
-rw-r--r--src/shared/pager.c2
-rw-r--r--src/shared/specifier.c31
-rw-r--r--src/systemctl/systemctl.c37
-rw-r--r--src/sysusers/sysusers.c61
-rw-r--r--src/test/test-cgroup-util.c10
-rw-r--r--src/test/test-fileio.c12
-rw-r--r--src/test/test-mount-util.c8
-rw-r--r--src/test/test-process-util.c2
-rw-r--r--src/timesync/timesyncd-manager.c15
-rw-r--r--src/tmpfiles/tmpfiles.c22
-rw-r--r--src/udev/collect/collect.c2
-rw-r--r--src/udev/udev-builtin-input_id.c22
-rw-r--r--src/udev/udev-builtin-net_id.c2
-rw-r--r--src/udev/udevd.c4
-rw-r--r--src/udev/v4l_id/v4l_id.c6
-rw-r--r--units/system-update-cleanup.service.in2
-rw-r--r--units/systemd-tmpfiles-setup-dev.service.in2
-rw-r--r--units/systemd-tmpfiles-setup.service.in2
64 files changed, 424 insertions, 180 deletions
diff --git a/NEWS b/NEWS
index 9ea239cc6c..52724587ed 100644
--- a/NEWS
+++ b/NEWS
@@ -11,7 +11,7 @@ CHANGES WITH 238:
other forms of resource accounting (CPU, IO, IP) remain off for now,
because it's not clear yet that their impact is small enough to move
from opt-in to opt-out. We recommend downstreams to leave memory
- accounting on by default if kernel 4.14 or higher is are primarily
+ accounting on by default if kernel 4.14 or higher is primarily
used. On very resource constrained systems or when support for old
kernels is a necessity, -Dmemory-accounting-default=false can be used
to revert this change.
@@ -35,12 +35,12 @@ CHANGES WITH 238:
disk (in case some of those files are owned by that user), while
still allowing local admin overrides.
- This functionality is exposed to rpm scriplets through a new
+ This functionality is exposed to rpm scriptlets through a new
%sysusers_create_package macro. Old %sysusers_create and
%sysusers_create_inline macros are deprecated.
A transfiletrigger for sysusers.d configuration is now installed,
- which means that it should be uncessary to call systemd-sysusers from
+ which means that it should be unnecessary to call systemd-sysusers from
package installation scripts, unless the package installs any files
owned by those newly-created users, in which case
%sysusers_create_package should be used.
diff --git a/README b/README
index 8807e5cfe4..b735214e2e 100644
--- a/README
+++ b/README
@@ -314,6 +314,17 @@ WARNINGS:
nice output only on exit(), hence on shutdown we don't execve()
systemd-shutdown.
+STABLE BRANCHES AND BACKPORTS
+
+ Stable branches with backported patches are available in the
+ systemd-stable repo at https://github.com/systemd/systemd-stable.
+
+ Stable branches are started for certain releases of systemd and named
+ after them, e.g. v238-stable. Stable branches are managed by
+ distribution maintainers on an as needed basis. See
+ https://www.freedesktop.org/wiki/Software/systemd/Backports/ for some
+ more information and examples.
+
ENGINEERING AND CONSULTING SERVICES:
Kinvolk (https://kinvolk.io) offers professional engineering
and consulting services for systemd. Please contact Chris Kühl
diff --git a/README.md b/README.md
index 4b017faf1b..c122d01731 100644
--- a/README.md
+++ b/README.md
@@ -21,3 +21,5 @@ Please see our [Contribution Guidelines](../master/.github/CONTRIBUTING.md) for
When preparing patches for systemd, please follow our [Coding Style Guidelines](../master/doc/CODING_STYLE).
If you are looking for support, please contact our [mailing list](https://lists.freedesktop.org/mailman/listinfo/systemd-devel) or join our [IRC channel](irc://irc.freenode.org/%23systemd).
+
+Stable branches with backported patches are available in the [stable repo](https://github.com/systemd/systemd-stable).
diff --git a/hwdb/60-evdev.hwdb b/hwdb/60-evdev.hwdb
index 2c6fdb1b69..e8e650cde6 100644
--- a/hwdb/60-evdev.hwdb
+++ b/hwdb/60-evdev.hwdb
@@ -114,8 +114,10 @@ evdev:name:ETPS/2 Elantech Touchpad:dmi:bvn*:bvr*:bd*:svnASUSTeKComputerInc.:pnK
EVDEV_ABS_35=::18
EVDEV_ABS_36=::16
-# Asus X550CC and S550CB
-evdev:name:ETPS/2 Elantech Touchpad:dmi:*:svnASUSTeKCOMPUTERINC.:pn?550C?:*
+# Asus X550CC, S550CB and N550JV
+evdev:name:ETPS/2 Elantech Touchpad:dmi:*:svnASUSTeKCOMPUTERINC.:pnX550CC:*
+evdev:name:ETPS/2 Elantech Touchpad:dmi:*:svnASUSTeKCOMPUTERINC.:pnS550CB:*
+evdev:name:ETPS/2 Elantech Touchpad:dmi:*:svnASUSTeKCOMPUTERINC.:pnN550JV:*
EVDEV_ABS_00=::31
EVDEV_ABS_01=::30
EVDEV_ABS_35=::31
@@ -144,6 +146,20 @@ evdev:name:AlpsPS/2 ALPS GlidePoint*:dmi:bvn*:bvr*:bd*:svnDellInc.:pnVostro1510*
EVDEV_ABS_00=::14
EVDEV_ABS_01=::18
+# Dell Inspiron 3537 - PS/2
+evdev:name:SynPS/2 Synaptics TouchPad:dmi:*svnDellInc.:pnInspiron3537*
+ EVDEV_ABS_00=1268:5675:41
+ EVDEV_ABS_01=1101:4792:61
+ EVDEV_ABS_35=1268:5675:41
+ EVDEV_ABS_36=1101:4792:61
+
+# Dell Inspiron 3537 - RMI4
+evdev:name:Synaptics TM2382-001:dmi:*svnDellInc.:pnInspiron3537*
+ EVDEV_ABS_00=::24
+ EVDEV_ABS_01=::34
+ EVDEV_ABS_35=::24
+ EVDEV_ABS_36=::34
+
# Dell Inspiron N5040
evdev:name:AlpsPS/2 ALPS DualPoint TouchPad:dmi:bvn*:bvr*:bd*:svnDellInc.:pnInspironN5040*
EVDEV_ABS_00=25:2000:22
@@ -241,6 +257,13 @@ evdev:name:SynPS/2 Synaptics TouchPad*:dmi:*svnHewlett-Packard:pnHPPaviliondv7*
EVDEV_ABS_35=1068:5805:44
EVDEV_ABS_36=1197:4890:57
+# HP Pavilion 15
+evdev:name:SynPS/2 Synaptics TouchPad:dmi:*svnHP:pnHPLaptop15-bs0xx:*
+ EVDEV_ABS_00=1272:5689:38
+ EVDEV_ABS_01=1029:4916:78
+ EVDEV_ABS_35=1272:5689:38
+ EVDEV_ABS_36=1029:4916:78
+
# HP Spectre
evdev:name:SynPS/2 Synaptics TouchPad:dmi:i*svnHP:pnHPSpectreNotebook*
EVDEV_ABS_00=1205:5691:47
@@ -390,6 +413,17 @@ evdev:name:SynPS/2 Synaptics TouchPad:dmi:*svnLENOVO*:pn*02173BG*:*pvrThinkPadEd
EVDEV_ABS_36=653:5395:116
#########################################
+# Razer
+#########################################
+
+# Razer Blade Stealth
+evdev:name:1A586753:00 06CB:8323 Touchpad:dmi:*svnRazer:pnBladeStealth:*
+ EVDEV_ABS_00=::12:8
+ EVDEV_ABS_01=::11:8
+ EVDEV_ABS_35=::12:8
+ EVDEV_ABS_36=::11:8
+
+#########################################
# Samsung
#########################################
diff --git a/hwdb/60-keyboard.hwdb b/hwdb/60-keyboard.hwdb
index 6406a7dbf9..808ed54a77 100644
--- a/hwdb/60-keyboard.hwdb
+++ b/hwdb/60-keyboard.hwdb
@@ -1421,3 +1421,24 @@ evdev:input:b0003v05FEp1010*
evdev:input:b0003v046Dp4002*
KEYBOARD_LED_NUMLOCK=0
KEYBOARD_LED_CAPSLOCK=0
+
+# Lenovo ThinkPad T430s
+evdev:atkbd:dmi:bvn*:bvr*:bd*:svnLENOVO:pn*:pvrThinkPadT430s
+ KEYBOARD_LED_CAPSLOCK=0
+
+# Lenovo ThinkPad T440s
+evdev:atkbd:dmi:bvn*:bvr*:bd*:svnLENOVO:pn*:pvrThinkPadT440s
+ KEYBOARD_LED_CAPSLOCK=0
+
+# Lenovo ThinkPad T450s
+evdev:atkbd:dmi:bvn*:bvr*:bd*:svnLENOVO:pn*:pvrThinkPadT450s
+ KEYBOARD_LED_CAPSLOCK=0
+
+# Lenovo ThinkPad T560s
+evdev:atkbd:dmi:bvn*:bvr*:bd*:svnLENOVO:pn*:pvrThinkPadT560s
+ KEYBOARD_LED_CAPSLOCK=0
+ KEYBOARD_LED_NUMLOCK=0
+
+# Lenovo ThinkPad X1 Carbon 3rd Gen
+evdev:atkbd:dmi:bvn*:bvr*:bd*:svnLENOVO:pn*:pvrThinkPadX1Carbon3rd
+ KEYBOARD_LED_CAPSLOCK=0
diff --git a/hwdb/60-sensor.hwdb b/hwdb/60-sensor.hwdb
index 77de5d21ba..8385efd28d 100644
--- a/hwdb/60-sensor.hwdb
+++ b/hwdb/60-sensor.hwdb
@@ -15,7 +15,7 @@
# /etc/udev/hwdb.d/61-sensor-local.hwdb
# and add your rules there. To load the new rules execute (as root):
# systemd-hwdb update
-# udevadm trigger -y `dirname $(udevadm info -n "/dev/iio:deviceXXX" -q path)`
+# udevadm trigger -v -p DEVNAME=/dev/iio:deviceXXX
# where /dev/iio:deviceXXX is the device in question.
#
# If your changes are generally applicable, preferably send them as a pull
@@ -82,7 +82,7 @@ sensor:modalias:acpi:SMO8500*:dmi:*svn*ASUSTeK*:*pn*TP500LB*
ACCEL_MOUNT_MATRIX=0, 1, 0; 1, 0, 0; 0, 0, 1
sensor:modalias:acpi:SMO8500*:dmi:*svn*ASUSTeK*:*pn*TP300LD*
- ACCEL_MOUNT_MATRIX=0, 1, 0; 1, 0, 0; 0, 0, 1
+ ACCEL_MOUNT_MATRIX=0, -1, 0; -1, 0, 0; 0, 0, 1
#########################################
# Axxo
@@ -148,6 +148,12 @@ sensor:modalias:acpi:ACCE0001*:dmi:*svnEndless*:*pnELT-NL3*
ACCEL_MOUNT_MATRIX=0, 1, 0; 0, 0, -1; -1, 0, 0
#########################################
+# Eve Technology
+#########################################
+sensor:modalias:acpi:KIOX000A*:dmi:*:svnEVE*:pnEveV:*
+ ACCEL_MOUNT_MATRIX=0, 1, 0; -1, 0, 0; 0, 0, 1
+
+#########################################
# GP-electronic
#########################################
sensor:modalias:acpi:KIOX000A*:dmi:bvnINSYDECorp.:bvrBYT70A.YNCHENG.WIN.007:*:svnInsyde:pnT701:*
diff --git a/man/hostnamectl.xml b/man/hostnamectl.xml
index fa70d5cc6c..9bfead6d21 100644
--- a/man/hostnamectl.xml
+++ b/man/hostnamectl.xml
@@ -121,6 +121,10 @@
<xi:include href="standard-options.xml" xpointer="help" />
<xi:include href="standard-options.xml" xpointer="version" />
</variablelist>
+ </refsect1>
+
+ <refsect1>
+ <title>Commands</title>
<para>The following commands are understood:</para>
@@ -128,9 +132,8 @@
<varlistentry>
<term><command>status</command></term>
- <listitem><para>Show current system
- hostname and related
- information.</para></listitem>
+ <listitem><para>Show current system hostname and related information. If no command is specified,
+ this is the implied default.</para></listitem>
</varlistentry>
<varlistentry>
diff --git a/man/localectl.xml b/man/localectl.xml
index 89a7ab2855..eff8bc3c9e 100644
--- a/man/localectl.xml
+++ b/man/localectl.xml
@@ -118,6 +118,10 @@
<xi:include href="standard-options.xml" xpointer="version" />
<xi:include href="standard-options.xml" xpointer="no-pager" />
</variablelist>
+ </refsect1>
+
+ <refsect1>
+ <title>Commands</title>
<para>The following commands are understood:</para>
@@ -125,8 +129,8 @@
<varlistentry>
<term><command>status</command></term>
- <listitem><para>Show current settings of the system locale and
- keyboard mapping.</para></listitem>
+ <listitem><para>Show current settings of the system locale and keyboard mapping.
+ If no command is specified, this is the implied default.</para></listitem>
</varlistentry>
<varlistentry>
diff --git a/man/machinectl.xml b/man/machinectl.xml
index c1fb0e02a2..93d5299d26 100644
--- a/man/machinectl.xml
+++ b/man/machinectl.xml
@@ -999,12 +999,12 @@
<title>Download a Fedora image, set a root password in it, start
it as service</title>
- <programlisting># machinectl pull-raw --verify=no https://dl.fedoraproject.org/pub/fedora/linux/releases/23/Cloud/x86_64/Images/Fedora-Cloud-Base-23-20151030.x86_64.raw.xz
-# systemd-nspawn -M Fedora-Cloud-Base-23-20151030
+ <programlisting># machinectl pull-raw --verify=no https://dl.fedoraproject.org/pub/fedora/linux/releases/27/CloudImages/x86_64/images/Fedora-Cloud-Base-27-1.6.x86_64.raw.xz
+# systemd-nspawn -M Fedora-Cloud-Base-27-1.6.x86_64
# passwd
# exit
-# machinectl start Fedora-Cloud-Base-23-20151030
-# machinectl login Fedora-Cloud-Base-23-20151030</programlisting>
+# machinectl start Fedora-Cloud-Base-27-1.6.x86_64
+# machinectl login Fedora-Cloud-Base-27-1.6.x86_64</programlisting>
<para>This downloads the specified <filename>.raw</filename>
image with verification disabled. Then, a shell is opened in it
diff --git a/man/systemd-nspawn.xml b/man/systemd-nspawn.xml
index e51da96474..b8b3d045eb 100644
--- a/man/systemd-nspawn.xml
+++ b/man/systemd-nspawn.xml
@@ -519,8 +519,10 @@
configured with <option>--network-veth</option>. If this
option is specified, the CAP_NET_ADMIN capability will be
added to the set of capabilities the container retains. The
- latter may be disabled by using
- <option>--drop-capability=</option>.</para></listitem>
+ latter may be disabled by using <option>--drop-capability=</option>.
+ If this option is not specified (or implied by one of the options
+ listed below), the container will have full access to the host network.
+ </para></listitem>
</varlistentry>
<varlistentry>
diff --git a/man/systemd-tmpfiles.xml b/man/systemd-tmpfiles.xml
index a6ae5e4f97..7c64dfaf58 100644
--- a/man/systemd-tmpfiles.xml
+++ b/man/systemd-tmpfiles.xml
@@ -225,11 +225,15 @@
<refsect1>
<title>Exit status</title>
- <para>On success, 0 is returned. If the configuration was invalid (invalid syntax, missing
- arguments, …), so some lines had to be ignored, but no other errors occurred,
+ <para>On success, 0 is returned. If the configuration was syntactically invalid (syntax errors,
+ missing arguments, …), so some lines had to be ignored, but no other errors occurred,
<constant>65</constant> is returned (<constant>EX_DATAERR</constant> from
- <filename>/usr/include/sysexits.h</filename>). Otherwise, <constant>1</constant> is returned
- (<constant>EXIT_FAILURE</constant> from <filename>/usr/include/stdlib.h</filename>).
+ <filename>/usr/include/sysexits.h</filename>). If the configuration was syntactically valid, but
+ could not be executed (lack of permissions, creation of files in missing directories, invalid
+ contents when writing to <filename>/sys/</filename> values, …), <constant>73</constant> is
+ returned (<constant>EX_DATAERR</constant> from <filename>/usr/include/sysexits.h</filename>).
+ Otherwise, <constant>1</constant> is returned (<constant>EXIT_FAILURE</constant> from
+ <filename>/usr/include/stdlib.h</filename>).
</para>
</refsect1>
diff --git a/man/timedatectl.xml b/man/timedatectl.xml
index dba94d8831..f24ec2d4c8 100644
--- a/man/timedatectl.xml
+++ b/man/timedatectl.xml
@@ -98,6 +98,10 @@
<xi:include href="standard-options.xml" xpointer="version" />
<xi:include href="standard-options.xml" xpointer="no-pager" />
</variablelist>
+ </refsect1>
+
+ <refsect1>
+ <title>Commands</title>
<para>The following commands are understood:</para>
@@ -109,6 +113,7 @@
including whether network time synchronization through
<filename>systemd-timesyncd.service</filename> is active. Even if it is
inactive, a different service might still synchronize the clock.
+ If no command is specified, this is the implied default.
</para></listitem>
</varlistentry>
diff --git a/meson.build b/meson.build
index 30b7f1bafa..358b41b9d1 100644
--- a/meson.build
+++ b/meson.build
@@ -604,7 +604,7 @@ endforeach
conf.set_quoted('TELINIT', get_option('telinit-path'))
if run_command('ln', '--relative', '--help').returncode() != 0
- error('ln does not support --relative')
+ error('ln does not support --relative (added in coreutils 8.16)')
endif
############################################################
@@ -2903,8 +2903,9 @@ foreach tuple : [
['debug mmap cache'],
]
- cond = tuple.get(1, '')
- if cond == ''
+ if tuple.length() >= 2
+ cond = tuple[1]
+ else
ident1 = 'HAVE_' + tuple[0].underscorify().to_upper()
ident2 = 'ENABLE_' + tuple[0].underscorify().to_upper()
cond = conf.get(ident1, 0) == 1 or conf.get(ident2, 0) == 1
diff --git a/shell-completion/bash/busctl b/shell-completion/bash/busctl
index d077675a32..c357c25bc3 100644
--- a/shell-completion/bash/busctl
+++ b/shell-completion/bash/busctl
@@ -48,7 +48,7 @@ __get_interfaces() {
local mode=$1
local busname=$2
local path=$3
- local a b
+ local a b c
busctl $mode introspect --list --no-legend --no-pager $busname $path | { while read a b c; do [[ "$b" == "interface" ]] && echo " $a"; done; };
}
@@ -58,8 +58,9 @@ __get_members() {
local path=$3
local interface=$4
local type=$5
- local a b
- busctl $mode introspect --list --no-legend --no-pager $busname $path $interface | sed -e 's/^\.//' | { while read a b c; do [[ "$b" == "$type" ]] && echo " $a"; done; };
+ local flags=$6
+ local a b c d e
+ busctl $mode introspect --list --no-legend --no-pager $busname $path $interface | sed -e 's/^\.//' | { while read a b c d e; do [[ "$b" == "$type" && ( -z $flags || "$e" == "$flags" ) ]] && echo " $a"; done; };
}
__get_signature() {
@@ -68,12 +69,12 @@ __get_signature() {
local path=$3
local interface=$4
local member=$5
- local a b
- busctl $mode introspect --list --no-legend --no-pager $busname $path $interface | sed -e 's/^\.//' | { while read a b c d; do [[ "$a" == "$member" ]] && echo " \"$c\""; done; };
+ local a b c d
+ busctl $mode introspect --list --no-legend --no-pager $busname $path $interface | sed -e 's/^\.//' | { while read a b c d; do [[ "$a" == "$member" && "$c" != '-' ]] && echo " \"$c\""; done; };
}
_busctl() {
- local i verb comps mode
+ local i n verb comps mode
local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]}
local -A OPTS=(
[STANDALONE]='-h --help --version --no-pager --no-legend --system --user
@@ -176,7 +177,7 @@ _busctl() {
elif [[ $n -eq 3 ]] ; then
comps=$( __get_interfaces $mode ${COMP_WORDS[COMP_CWORD-2]} ${COMP_WORDS[COMP_CWORD-1]})
elif [[ $n -eq 4 ]] ; then
- comps=$( __get_members $mode ${COMP_WORDS[COMP_CWORD-3]} ${COMP_WORDS[COMP_CWORD-2]} ${COMP_WORDS[COMP_CWORD-1]} property)
+ comps=$( __get_members $mode ${COMP_WORDS[COMP_CWORD-3]} ${COMP_WORDS[COMP_CWORD-2]} ${COMP_WORDS[COMP_CWORD-1]} property writable)
elif [[ $n -eq 5 ]] ; then
comps=$( __get_signature $mode ${COMP_WORDS[COMP_CWORD-4]} ${COMP_WORDS[COMP_CWORD-3]} ${COMP_WORDS[COMP_CWORD-2]} ${COMP_WORDS[COMP_CWORD-1]})
else
diff --git a/shell-completion/zsh/_systemd-analyze b/shell-completion/zsh/_systemd-analyze
index bccdb951f1..56982e3d11 100644
--- a/shell-completion/zsh/_systemd-analyze
+++ b/shell-completion/zsh/_systemd-analyze
@@ -33,12 +33,13 @@ _systemd_analyze_command(){
'plot:Output SVG graphic showing service initialization'
'dot:Dump dependency graph (in dot(1) format)'
'dump:Dump server status'
- 'unit-paths':List unit load paths'
+ 'unit-paths:List unit load paths'
'log-level:Get/set systemd log threshold'
'log-target:Get/set systemd log target'
'service-watchdogs:Get/set service watchdog status'
'syscall-filter:List syscalls in seccomp filter'
'verify:Check unit files for correctness'
+ 'calendar:Validate repetitive calendar time events'
)
if (( CURRENT == 1 )); then
diff --git a/src/basic/calendarspec.c b/src/basic/calendarspec.c
index fd78022773..8f3bb9102f 100644
--- a/src/basic/calendarspec.c
+++ b/src/basic/calendarspec.c
@@ -181,6 +181,8 @@ int calendar_spec_normalize(CalendarSpec *c) {
}
_pure_ static bool chain_valid(CalendarComponent *c, int from, int to, bool end_of_month) {
+ assert(to >= from);
+
if (!c)
return true;
@@ -191,6 +193,10 @@ _pure_ static bool chain_valid(CalendarComponent *c, int from, int to, bool end_
if (c->start < from || c->start > to)
return false;
+ /* Avoid overly large values that could cause overflow */
+ if (c->repeat > to - from)
+ return false;
+
/*
* c->repeat must be short enough so at least one repetition may
* occur before the end of the interval. For dates scheduled
diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c
index 9a4dd72270..c0962f288f 100644
--- a/src/basic/cgroup-util.c
+++ b/src/basic/cgroup-util.c
@@ -2038,7 +2038,6 @@ int cg_get_keyed_attribute(
char **ret_values) {
_cleanup_free_ char *filename = NULL, *contents = NULL;
- _cleanup_fclose_ FILE *f = NULL;
const char *p;
size_t n, i, n_done = 0;
char **v;
diff --git a/src/basic/fd-util.h b/src/basic/fd-util.h
index 635a538b5a..c68f482eb2 100644
--- a/src/basic/fd-util.h
+++ b/src/basic/fd-util.h
@@ -98,6 +98,10 @@ int acquire_data_fd(const void *data, size_t size, unsigned flags);
#define ERRNO_IS_DISCONNECT(r) \
IN_SET(r, ENOTCONN, ECONNRESET, ECONNREFUSED, ECONNABORTED, EPIPE, ENETUNREACH)
+/* Resource exhaustion, could be our fault or general system trouble */
+#define ERRNO_IS_RESOURCE(r) \
+ IN_SET(r, ENOMEM, EMFILE, ENFILE)
+
int fd_move_above_stdio(int fd);
int rearrange_stdio(int original_input_fd, int original_output_fd, int original_error_fd);
diff --git a/src/basic/generate-af-list.sh b/src/basic/generate-af-list.sh
index fa74198e58..39e2dad5e7 100755
--- a/src/basic/generate-af-list.sh
+++ b/src/basic/generate-af-list.sh
@@ -3,4 +3,4 @@ set -eu
$1 -E -dM -include sys/socket.h - </dev/null | \
grep -Ev 'AF_UNSPEC|AF_MAX' | \
- awk '/^#define[ \t]+AF_[^ \t]+[ \t]+PF_[^ \t]/ { print $2; }'
+ awk '/^#define[ \t]+AF_[^ \t]+[ \t]+[AP]F_[^ \t]/ { print $2; }'
diff --git a/src/basic/log.c b/src/basic/log.c
index 7a7f2cbec1..16a2431c54 100644
--- a/src/basic/log.c
+++ b/src/basic/log.c
@@ -814,7 +814,7 @@ static void log_assert(
log_dispatch_internal(level, 0, file, line, func, NULL, NULL, NULL, NULL, buffer);
}
-noreturn void log_assert_failed_realm(
+_noreturn_ void log_assert_failed_realm(
LogRealm realm,
const char *text,
const char *file,
@@ -826,7 +826,7 @@ noreturn void log_assert_failed_realm(
abort();
}
-noreturn void log_assert_failed_unreachable_realm(
+_noreturn_ void log_assert_failed_unreachable_realm(
LogRealm realm,
const char *text,
const char *file,
diff --git a/src/basic/log.h b/src/basic/log.h
index efcf0f1bfc..314be128a2 100644
--- a/src/basic/log.h
+++ b/src/basic/log.h
@@ -186,7 +186,7 @@ int log_dump_internal(
char *buffer);
/* Logging for various assertions */
-noreturn void log_assert_failed_realm(
+_noreturn_ void log_assert_failed_realm(
LogRealm realm,
const char *text,
const char *file,
@@ -195,7 +195,7 @@ noreturn void log_assert_failed_realm(
#define log_assert_failed(text, ...) \
log_assert_failed_realm(LOG_REALM, (text), __VA_ARGS__)
-noreturn void log_assert_failed_unreachable_realm(
+_noreturn_ void log_assert_failed_unreachable_realm(
LogRealm realm,
const char *text,
const char *file,
diff --git a/src/basic/macro.h b/src/basic/macro.h
index 89bdd852a9..3a6fc6f585 100644
--- a/src/basic/macro.h
+++ b/src/basic/macro.h
@@ -53,6 +53,15 @@
#else
#define _fallthrough_
#endif
+/* Define C11 noreturn without <stdnoreturn.h> and even on older gcc
+ * compiler versions */
+#ifndef _noreturn_
+#if __STDC_VERSION__ >= 201112L
+#define _noreturn_ _Noreturn
+#else
+#define _noreturn_ __attribute__((noreturn))
+#endif
+#endif
/* Temporarily disable some warnings */
#define DISABLE_WARNING_DECLARATION_AFTER_STATEMENT \
@@ -414,16 +423,6 @@ static inline unsigned long ALIGN_POWER2(unsigned long u) {
#endif
#endif
-/* Define C11 noreturn without <stdnoreturn.h> and even on older gcc
- * compiler versions */
-#ifndef noreturn
-#if __STDC_VERSION__ >= 201112L
-#define noreturn _Noreturn
-#else
-#define noreturn __attribute__((noreturn))
-#endif
-#endif
-
#define DEFINE_TRIVIAL_CLEANUP_FUNC(type, func) \
static inline void func##p(type *p) { \
if (*p) \
diff --git a/src/basic/process-util.c b/src/basic/process-util.c
index aa9846db5d..e6120af5b6 100644
--- a/src/basic/process-util.c
+++ b/src/basic/process-util.c
@@ -987,7 +987,7 @@ bool is_main_thread(void) {
return cached > 0;
}
-noreturn void freeze(void) {
+_noreturn_ void freeze(void) {
log_close();
diff --git a/src/basic/process-util.h b/src/basic/process-util.h
index 93029e36e5..5170adec7b 100644
--- a/src/basic/process-util.h
+++ b/src/basic/process-util.h
@@ -91,7 +91,7 @@ int pid_from_same_root_fs(pid_t pid);
bool is_main_thread(void);
-noreturn void freeze(void);
+_noreturn_ void freeze(void);
bool oom_score_adjust_is_valid(int oa);
diff --git a/src/basic/stat-util.c b/src/basic/stat-util.c
index 3689f6e983..67705947aa 100644
--- a/src/basic/stat-util.c
+++ b/src/basic/stat-util.c
@@ -254,7 +254,8 @@ int fd_is_network_ns(int fd) {
if (r <= 0)
return r;
- if (ioctl(fd, NS_GET_NSTYPE) < 0)
+ r = ioctl(fd, NS_GET_NSTYPE);
+ if (r < 0)
return -errno;
return r == CLONE_NEWNET;
diff --git a/src/busctl/busctl.c b/src/busctl/busctl.c
index f8c43b5079..ae132dffbe 100644
--- a/src/busctl/busctl.c
+++ b/src/busctl/busctl.c
@@ -112,6 +112,9 @@ static int list_bus_names(sd_bus *bus, char **argv) {
}
merged = new(char*, hashmap_size(names) + 1);
+ if (!merged)
+ return log_oom();
+
HASHMAP_FOREACH_KEY(v, k, names, iterator)
merged[n++] = k;
@@ -283,8 +286,6 @@ static void print_subtree(const char *prefix, const char *path, char **l) {
static void print_tree(const char *prefix, char **l) {
- pager_open(arg_no_pager, false);
-
prefix = strempty(prefix);
if (arg_list) {
diff --git a/src/core/cgroup.c b/src/core/cgroup.c
index 3c0ff09639..a923ab8a76 100644
--- a/src/core/cgroup.c
+++ b/src/core/cgroup.c
@@ -2272,19 +2272,20 @@ int manager_setup_cgroup(Manager *m) {
/* 5. Make sure we are in the special "init.scope" unit in the root slice. */
scope_path = strjoina(m->cgroup_root, "/" SPECIAL_INIT_SCOPE);
r = cg_create_and_attach(SYSTEMD_CGROUP_CONTROLLER, scope_path, 0);
- if (r < 0)
- return log_error_errno(r, "Failed to create %s control group: %m", scope_path);
+ if (r >= 0) {
+ /* Also, move all other userspace processes remaining in the root cgroup into that scope. */
+ r = cg_migrate(SYSTEMD_CGROUP_CONTROLLER, m->cgroup_root, SYSTEMD_CGROUP_CONTROLLER, scope_path, 0);
+ if (r < 0)
+ log_warning_errno(r, "Couldn't move remaining userspace processes, ignoring: %m");
- /* Also, move all other userspace processes remaining in the root cgroup into that scope. */
- r = cg_migrate(SYSTEMD_CGROUP_CONTROLLER, m->cgroup_root, SYSTEMD_CGROUP_CONTROLLER, scope_path, 0);
- if (r < 0)
- log_warning_errno(r, "Couldn't move remaining userspace processes, ignoring: %m");
+ /* 6. And pin it, so that it cannot be unmounted */
+ safe_close(m->pin_cgroupfs_fd);
+ m->pin_cgroupfs_fd = open(path, O_RDONLY|O_CLOEXEC|O_DIRECTORY|O_NOCTTY|O_NONBLOCK);
+ if (m->pin_cgroupfs_fd < 0)
+ return log_error_errno(errno, "Failed to open pin file: %m");
- /* 6. And pin it, so that it cannot be unmounted */
- safe_close(m->pin_cgroupfs_fd);
- m->pin_cgroupfs_fd = open(path, O_RDONLY|O_CLOEXEC|O_DIRECTORY|O_NOCTTY|O_NONBLOCK);
- if (m->pin_cgroupfs_fd < 0)
- return log_error_errno(errno, "Failed to open pin file: %m");
+ } else if (r < 0 && !m->test_run_flags)
+ return log_error_errno(r, "Failed to create %s control group: %m", scope_path);
/* 7. Always enable hierarchical support if it exists... */
if (!all_unified && m->test_run_flags == 0)
@@ -2305,7 +2306,7 @@ void manager_shutdown_cgroup(Manager *m, bool delete) {
/* We can't really delete the group, since we are in it. But
* let's trim it. */
- if (delete && m->cgroup_root)
+ if (delete && m->cgroup_root && m->test_run_flags != MANAGER_TEST_RUN_MINIMAL)
(void) cg_trim(SYSTEMD_CGROUP_CONTROLLER, m->cgroup_root, false);
m->cgroup_empty_event_source = sd_event_source_unref(m->cgroup_empty_event_source);
diff --git a/src/core/dbus-execute.c b/src/core/dbus-execute.c
index 635213a866..c6c7f26773 100644
--- a/src/core/dbus-execute.c
+++ b/src/core/dbus-execute.c
@@ -18,6 +18,7 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
+#include <sys/mount.h>
#include <sys/prctl.h>
#include <stdio_ext.h>
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
index 1e3416c40b..5b30c47e83 100644
--- a/src/core/load-fragment.c
+++ b/src/core/load-fragment.c
@@ -257,11 +257,19 @@ int config_parse_unit_path_printf(
assert(rvalue);
assert(u);
+ /* Let's not bother with anything that is too long */
+ if (strlen(rvalue) >= PATH_MAX) {
+ log_syntax(unit, LOG_ERR, filename, line, 0,
+ "%s value too long%s.",
+ lvalue, fatal ? "" : ", ignoring");
+ return fatal ? -ENAMETOOLONG : 0;
+ }
+
r = unit_full_printf(u, rvalue, &k);
if (r < 0) {
log_syntax(unit, LOG_ERR, filename, line, r,
- "Failed to resolve unit specifiers on %s%s: %m",
- fatal ? "" : ", ignoring", rvalue);
+ "Failed to resolve unit specifiers in \"%s\"%s: %m",
+ rvalue, fatal ? "" : ", ignoring");
return fatal ? -ENOEXEC : 0;
}
diff --git a/src/core/macros.systemd.in b/src/core/macros.systemd.in
index 4e27e1b06a..6a162a0ec8 100644
--- a/src/core/macros.systemd.in
+++ b/src/core/macros.systemd.in
@@ -101,7 +101,9 @@ systemd-sysusers %{?*} >/dev/null 2>&1 || : \
%{nil}
%sysusers_create_inline() \
-echo %{?*} | systemd-sysusers - >/dev/null 2>&1 || : \
+systemd-sysusers - <<SYSTEMD_INLINE_EOF >/dev/null 2>&1 || : \
+%{?*} \
+SYSTEMD_INLINE_EOF \
%{nil}
# This should be used by package installation scripts which require users or
@@ -118,7 +120,9 @@ echo %{?*} | systemd-sysusers - >/dev/null 2>&1 || : \
# %files
# %{_sysusersdir}/%{name}.conf
%sysusers_create_package() \
-echo "%(cat %2)" | systemd-sysusers --replace=%_sysusersdir/%1.conf - >/dev/null 2>&1 || : \
+systemd-sysusers --replace=%_sysusersdir/%1.conf - <<SYSTEMD_INLINE_EOF >/dev/null 2>&1 || : \
+%(cat %2) \
+SYSTEMD_INLINE_EOF \
%{nil}
# This may be used by package installation scripts to create files according to
@@ -135,7 +139,9 @@ echo "%(cat %2)" | systemd-sysusers --replace=%_sysusersdir/%1.conf - >/dev/null
# %files
# %{_tmpfilesdir}/%{name}.conf
%tmpfiles_create_package() \
-echo "%(cat %2)" | systemd-tmpfiles --replace=%_tmpfilesdir/%1.conf --create - >/dev/null 2>&1 || : \
+systemd-tmpfiles --replace=%_tmpfilesdir/%1.conf --create - <<SYSTEMD_INLINE_EOF >/dev/null 2>&1 || : \
+%(cat %2) \
+SYSTEMD_INLINE_EOF \
%{nil}
%sysctl_apply() \
diff --git a/src/core/main.c b/src/core/main.c
index 00faa10824..d6ae0c3602 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -141,7 +141,7 @@ static uint64_t arg_default_tasks_max = UINT64_MAX;
static sd_id128_t arg_machine_id = {};
static EmergencyAction arg_cad_burst_action = EMERGENCY_ACTION_REBOOT_FORCE;
-noreturn static void freeze_or_reboot(void) {
+_noreturn_ static void freeze_or_reboot(void) {
if (arg_crash_reboot) {
log_notice("Rebooting in 10s...");
@@ -156,7 +156,7 @@ noreturn static void freeze_or_reboot(void) {
freeze();
}
-noreturn static void crash(int sig) {
+_noreturn_ static void crash(int sig) {
struct sigaction sa;
pid_t pid;
diff --git a/src/core/manager.h b/src/core/manager.h
index d4eaaa1c4b..152640bd83 100644
--- a/src/core/manager.h
+++ b/src/core/manager.h
@@ -20,7 +20,6 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#include <libmount.h>
#include <stdbool.h>
#include <stdio.h>
@@ -34,6 +33,8 @@
#include "list.h"
#include "ratelimit.h"
+struct libmnt_monitor;
+
/* Enforce upper limit how many names we allow */
#define MANAGER_MAX_NAMES 131072 /* 128K */
diff --git a/src/core/mount.c b/src/core/mount.c
index cfe8ec9044..fb55c71d3c 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -23,6 +23,8 @@
#include <stdio.h>
#include <sys/epoll.h>
+#include <libmount.h>
+
#include "sd-messages.h"
#include "alloc-util.h"
diff --git a/src/core/triggers.systemd.in b/src/core/triggers.systemd.in
index c582d40977..4ebb4e7795 100644
--- a/src/core/triggers.systemd.in
+++ b/src/core/triggers.systemd.in
@@ -84,7 +84,7 @@ if posix.access("/run/systemd/system") then
end
end
-%transfiletriggerin -P 100500 -- @tmpfilesdir@
+%transfiletriggerin -P 100500 -p <lua> -- @tmpfilesdir@
-- This script will process files installed in @tmpfilesdir@ to create
-- tmpfiles automatically. The priority is set such that it will run
-- after the sysusers file trigger, but before any other triggers.
@@ -97,7 +97,7 @@ if posix.access("/run/systemd/system") then
end
end
-%transfiletriggerin -- @udevhwdbdir@
+%transfiletriggerin -p <lua> -- @udevhwdbdir@
-- This script will automatically invoke hwdb update if files have been
-- installed or updated in @udevhwdbdir@.
if posix.access("/run/systemd/system") then
@@ -109,7 +109,7 @@ if posix.access("/run/systemd/system") then
end
end
-%transfiletriggerin -- @catalogdir@
+%transfiletriggerin -p <lua> -- @catalogdir@
-- This script will automatically invoke journal catalog update if files
-- have been installed or updated in @catalogdir@.
if posix.access("/run/systemd/system") then
@@ -121,7 +121,7 @@ if posix.access("/run/systemd/system") then
end
end
-%transfiletriggerin -- @udevrulesdir@
+%transfiletriggerin -p <lua> -- @udevrulesdir@
-- This script will automatically update udev with new rules if files
-- have been installed or updated in @udevrulesdir@.
if posix.access("/run/systemd/system") then
@@ -133,7 +133,7 @@ if posix.access("/run/systemd/system") then
end
end
-%transfiletriggerin -- @sysctldir@
+%transfiletriggerin -p <lua> -- @sysctldir@
-- This script will automatically apply sysctl rules if files have been
-- installed or updated in @sysctldir@.
if posix.access("/run/systemd/system") then
@@ -145,7 +145,7 @@ if posix.access("/run/systemd/system") then
end
end
-%transfiletriggerin -- @binfmtdir@
+%transfiletriggerin -p <lua> -- @binfmtdir@
-- This script will automatically apply binfmt rules if files have been
-- installed or updated in @binfmtdir@.
if posix.access("/run/systemd/system") then
diff --git a/src/core/umount.c b/src/core/umount.c
index ff3e63710c..de826edd4d 100644
--- a/src/core/umount.c
+++ b/src/core/umount.c
@@ -61,6 +61,8 @@ static void mount_point_free(MountPoint **head, MountPoint *m) {
LIST_REMOVE(mount_point, *head, m);
free(m->path);
+ free(m->options);
+ free(m->type);
free(m);
}
@@ -313,7 +315,7 @@ static int dm_list_get(MountPoint **head) {
if (!node)
return -ENOMEM;
- m = new(MountPoint, 1);
+ m = new0(MountPoint, 1);
if (!m) {
free(node);
return -ENOMEM;
diff --git a/src/core/unit.c b/src/core/unit.c
index c3056624ef..ce15b8e088 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -2502,8 +2502,11 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns, bool reload_su
}
}
- manager_recheck_journal(m);
- manager_recheck_dbus(m);
+ if (!MANAGER_IS_RELOADING(u->manager)) {
+ manager_recheck_journal(m);
+ manager_recheck_dbus(m);
+ }
+
unit_trigger_notify(u);
if (!MANAGER_IS_RELOADING(u->manager)) {
diff --git a/src/journal-remote/meson.build b/src/journal-remote/meson.build
index 5fdc4cccd7..cbe2be19c7 100644
--- a/src/journal-remote/meson.build
+++ b/src/journal-remote/meson.build
@@ -61,6 +61,6 @@ if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_MICROHTTPD') == 1
meson.add_install_script('sh', '-c',
mkdir_p.format('/var/log/journal/remote'))
meson.add_install_script('sh', '-c',
- 'chown 0:0 $DESTDIR/var/log/journal/remote &&
- chmod 755 $DESTDIR/var/log/journal/remote || :')
+ '''chown 0:0 $DESTDIR/var/log/journal/remote &&
+ chmod 755 $DESTDIR/var/log/journal/remote || :''')
endif
diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c
index 5643c0578d..9a225060b6 100644
--- a/src/journal/journal-file.c
+++ b/src/journal/journal-file.c
@@ -2187,7 +2187,7 @@ static int generic_array_bisect(
a = first;
ci = ordered_hashmap_get(f->chain_cache, &first);
- if (ci && n > ci->total) {
+ if (ci && n > ci->total && ci->begin != 0) {
/* Ah, we have iterated this bisection array chain
* previously! Let's see if we can skip ahead in the
* chain, as far as the last time. But we can't jump
diff --git a/src/journal/journal-verify.c b/src/journal/journal-verify.c
index dc6b21b1e9..4d35168591 100644
--- a/src/journal/journal-verify.c
+++ b/src/journal/journal-verify.c
@@ -1245,7 +1245,7 @@ int journal_file_verify(
}
if (entry_monotonic_set &&
- (!sd_id128_equal(entry_boot_id, f->header->boot_id) ||
+ (sd_id128_equal(entry_boot_id, f->header->boot_id) &&
entry_monotonic != le64toh(f->header->tail_entry_monotonic))) {
error(0, "Invalid tail monotonic timestamp");
r = -EBADMSG;
diff --git a/src/journal/test-journal-interleaving.c b/src/journal/test-journal-interleaving.c
index 5a88b2774f..d87bdbdd32 100644
--- a/src/journal/test-journal-interleaving.c
+++ b/src/journal/test-journal-interleaving.c
@@ -37,7 +37,7 @@
static bool arg_keep = false;
-noreturn static void log_assert_errno(const char *text, int error, const char *file, int line, const char *func) {
+_noreturn_ static void log_assert_errno(const char *text, int error, const char *file, int line, const char *func) {
log_internal(LOG_CRIT, error, file, line, func,
"'%s' failed at %s:%u (%s): %m", text, file, line, func);
abort();
diff --git a/src/libsystemd/sd-bus/bus-socket.c b/src/libsystemd/sd-bus/bus-socket.c
index b5160cff6a..082688b17e 100644
--- a/src/libsystemd/sd-bus/bus-socket.c
+++ b/src/libsystemd/sd-bus/bus-socket.c
@@ -960,14 +960,9 @@ int bus_socket_exec(sd_bus *b) {
if (r == 0) {
/* Child */
- safe_close(s[0]);
-
if (rearrange_stdio(s[1], s[1], STDERR_FILENO) < 0)
_exit(EXIT_FAILURE);
- (void) fd_nonblock(STDIN_FILENO, false);
- (void) fd_nonblock(STDOUT_FILENO, false);
-
if (b->exec_argv)
execvp(b->exec_path, b->exec_argv);
else {
diff --git a/src/login/inhibit.c b/src/login/inhibit.c
index 6b5d9c29b9..c118421e6b 100644
--- a/src/login/inhibit.c
+++ b/src/login/inhibit.c
@@ -254,6 +254,9 @@ int main(int argc, char *argv[]) {
_cleanup_free_ char *w = NULL;
pid_t pid;
+ /* Ignore SIGINT and allow the forked process to receive it */
+ (void) ignore_signals(SIGINT, -1);
+
if (!arg_who)
arg_who = w = strv_join(argv + optind, " ");
diff --git a/src/network/networkd-manager.c b/src/network/networkd-manager.c
index 4f55c0172f..1c519d8c49 100644
--- a/src/network/networkd-manager.c
+++ b/src/network/networkd-manager.c
@@ -1825,7 +1825,7 @@ int manager_set_timezone(Manager *m, const char *tz) {
return log_oom();
if (!m->bus || sd_bus_is_ready(m->bus) <= 0) {
- log_info("Not connected to system bus, not setting hostname.");
+ log_info("Not connected to system bus, not setting timezone.");
return 0;
}
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index 90f1c4184f..8959fd3172 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -2323,17 +2323,25 @@ static int inner_child(
arg_uid_shift,
arg_uid_range,
arg_selinux_apifs_context);
-
if (r < 0)
return r;
+ if (!arg_network_namespace_path && arg_private_network) {
+ r = unshare(CLONE_NEWNET);
+ if (r < 0)
+ return log_error_errno(errno, "Failed to unshare network namespace: %m");
+
+ /* Tell the parent that it can setup network interfaces. */
+ (void) barrier_place(barrier); /* #3 */
+ }
+
r = mount_sysfs(NULL, arg_mount_settings);
if (r < 0)
return r;
/* Wait until we are cgroup-ified, so that we
* can mount the right cgroup path writable */
- if (!barrier_place_and_sync(barrier)) { /* #3 */
+ if (!barrier_place_and_sync(barrier)) { /* #4 */
log_error("Parent died too early");
return -ESRCH;
}
@@ -2341,7 +2349,7 @@ static int inner_child(
if (arg_use_cgns && cg_ns_supported()) {
r = unshare(CLONE_NEWCGROUP);
if (r < 0)
- return log_error_errno(errno, "Failed to unshare cgroup namespace");
+ return log_error_errno(errno, "Failed to unshare cgroup namespace: %m");
r = mount_cgroups(
"",
arg_unified_cgroup_hierarchy,
@@ -2444,7 +2452,7 @@ static int inner_child(
/* Let the parent know that we are ready and
* wait until the parent is ready with the
* setup, too... */
- if (!barrier_place_and_sync(barrier)) { /* #4 */
+ if (!barrier_place_and_sync(barrier)) { /* #5 */
log_error("Parent died too early");
return -ESRCH;
}
@@ -2568,7 +2576,6 @@ static int outer_child(
ssize_t l;
int r;
_cleanup_close_ int fd = -1;
- bool create_netns;
assert(barrier);
assert(directory);
@@ -2811,11 +2818,8 @@ static int outer_child(
if (fd < 0)
return fd;
- create_netns = !arg_network_namespace_path && arg_private_network;
-
pid = raw_clone(SIGCHLD|CLONE_NEWNS|
arg_clone_ns_flags |
- (create_netns ? CLONE_NEWNET : 0) |
(arg_userns_mode != USER_NAMESPACE_NO ? CLONE_NEWUSER : 0));
if (pid < 0)
return log_error_errno(errno, "Failed to fork inner child: %m");
@@ -3556,6 +3560,14 @@ static int run(int master,
if (arg_private_network) {
+ if (!arg_network_namespace_path) {
+ /* Wait until the child has unshared its network namespace. */
+ if (!barrier_place_and_sync(&barrier)) { /* #3 */
+ log_error("Child died too early");
+ return -ESRCH;
+ }
+ }
+
r = move_network_interfaces(*pid, arg_network_interfaces);
if (r < 0)
return r;
@@ -3679,7 +3691,7 @@ static int run(int master,
* its setup (including cgroup-ification), and that
* the child can now hand over control to the code to
* run inside the container. */
- (void) barrier_place(&barrier); /* #3 */
+ (void) barrier_place(&barrier); /* #4 */
/* Block SIGCHLD here, before notifying child.
* process_pty() will handle it with the other signals. */
@@ -3707,7 +3719,7 @@ static int run(int master,
return r;
/* Let the child know that we are ready and wait that the child is completely ready now. */
- if (!barrier_place_and_sync(&barrier)) { /* #4 */
+ if (!barrier_place_and_sync(&barrier)) { /* #5 */
log_error("Child died too early.");
return -ESRCH;
}
diff --git a/src/resolve/resolve-tool.c b/src/resolve/resolve-tool.c
index fce86d1e74..d7515721b6 100644
--- a/src/resolve/resolve-tool.c
+++ b/src/resolve/resolve-tool.c
@@ -2398,11 +2398,11 @@ int main(int argc, char **argv) {
STRV_FOREACH(ifname, argv + optind) {
int ifindex, q;
- q = parse_ifindex(argv[optind], &ifindex);
+ q = parse_ifindex(*ifname, &ifindex);
if (q < 0) {
- ifindex = if_nametoindex(argv[optind]);
+ ifindex = if_nametoindex(*ifname);
if (ifindex <= 0) {
- log_error_errno(errno, "Failed to resolve interface name: %s", argv[optind]);
+ log_error_errno(errno, "Failed to resolve interface name '%s': %m", *ifname);
continue;
}
}
diff --git a/src/shared/machine-image.c b/src/shared/machine-image.c
index 66eefb3036..de67058207 100644
--- a/src/shared/machine-image.c
+++ b/src/shared/machine-image.c
@@ -881,8 +881,13 @@ int image_path_lock(const char *path, int operation, LockFile *global, LockFile
* block devices are device local anyway. */
if (!path_startswith(path, "/dev")) {
r = make_lock_file_for(path, operation, &t);
- if (r < 0)
- return r;
+ if (r < 0) {
+ if ((operation & LOCK_SH) && r == -EROFS)
+ log_debug_errno(r, "Failed to create shared "
+ "lock for %s: %m", path);
+ else
+ return r;
+ }
}
if (p) {
diff --git a/src/shared/pager.c b/src/shared/pager.c
index 75db3c985b..681af9c40e 100644
--- a/src/shared/pager.c
+++ b/src/shared/pager.c
@@ -47,7 +47,7 @@ static int stored_stderr = -1;
static bool stdout_redirected = false;
static bool stderr_redirected = false;
-noreturn static void pager_fallback(void) {
+_noreturn_ static void pager_fallback(void) {
int r;
r = copy_bytes(STDIN_FILENO, STDOUT_FILENO, (uint64_t) -1, 0);
diff --git a/src/shared/specifier.c b/src/shared/specifier.c
index 23aaa88c4b..849ff67e76 100644
--- a/src/shared/specifier.c
+++ b/src/shared/specifier.c
@@ -46,7 +46,7 @@
#define POSSIBLE_SPECIFIERS ALPHANUMERICAL "%"
int specifier_printf(const char *text, const Specifier table[], void *userdata, char **_ret) {
- size_t l;
+ size_t l, allocated = 0;
_cleanup_free_ char *ret = NULL;
char *t;
const char *f;
@@ -57,14 +57,11 @@ int specifier_printf(const char *text, const Specifier table[], void *userdata,
assert(table);
l = strlen(text);
- ret = new(char, l+1);
- if (!ret)
+ if (!GREEDY_REALLOC(ret, allocated, l + 1))
return -ENOMEM;
-
t = ret;
- for (f = text; *f; f++, l--) {
-
+ for (f = text; *f; f++, l--)
if (percent) {
if (*f == '%')
*(t++) = '%';
@@ -77,7 +74,6 @@ int specifier_printf(const char *text, const Specifier table[], void *userdata,
if (i->lookup) {
_cleanup_free_ char *w = NULL;
- char *n;
size_t k, j;
r = i->lookup(i->specifier, i->data, userdata, &w);
@@ -87,14 +83,9 @@ int specifier_printf(const char *text, const Specifier table[], void *userdata,
j = t - ret;
k = strlen(w);
- n = new(char, j + k + l + 1);
- if (!n)
+ if (!GREEDY_REALLOC(ret, allocated, j + k + l + 1))
return -ENOMEM;
-
- memcpy(n, ret, j);
- memcpy(n + j, w, k);
-
- free_and_replace(ret, n);
+ memcpy(ret + j, w, k);
t = ret + j + k;
} else if (strchr(POSSIBLE_SPECIFIERS, *f))
/* Oops, an unknown specifier. */
@@ -110,13 +101,19 @@ int specifier_printf(const char *text, const Specifier table[], void *userdata,
percent = true;
else
*(t++) = *f;
- }
- /* if string ended with a stray %, also end with % */
+ /* If string ended with a stray %, also end with % */
if (percent)
*(t++) = '%';
+ *(t++) = 0;
+
+ /* Try to deallocate unused bytes, but don't sweat it too much */
+ if ((size_t)(t - ret) < allocated) {
+ t = realloc(ret, t - ret);
+ if (t)
+ ret = t;
+ }
- *t = 0;
*_ret = ret;
ret = NULL;
return 0;
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 1e975a5f2f..6ae97cf107 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -2915,8 +2915,8 @@ static int start_unit_one(
return log_error_errno(r, "Failed to request match for PropertiesChanged signal: %m");
}
- log_debug("%s manager for %s on %s, %s",
- arg_dry_run ? "Would call" : "Calling",
+ log_debug("%s dbus call org.freedesktop.systemd1.Manager %s(%s, %s)",
+ arg_dry_run ? "Would execute" : "Executing",
method, name, mode);
if (arg_dry_run)
return 0;
@@ -3215,6 +3215,10 @@ static int logind_set_wall_message(void) {
if (!m)
return log_oom();
+ log_debug("%s wall message \"%s\".", arg_dry_run ? "Would set" : "Setting", m);
+ if (arg_dry_run)
+ return 0;
+
r = sd_bus_call_method(
bus,
"org.freedesktop.login1",
@@ -3285,6 +3289,10 @@ static int logind_reboot(enum action a) {
polkit_agent_open_maybe();
(void) logind_set_wall_message();
+ log_debug("%s org.freedesktop.login1.Manager %s dbus call.", arg_dry_run ? "Would execute" : "Executing", method);
+ if (arg_dry_run)
+ return 0;
+
r = sd_bus_call_method(
bus,
"org.freedesktop.login1",
@@ -3483,6 +3491,9 @@ static int load_kexec_kernel(void) {
return 0;
}
+ if (access(KEXEC, X_OK) < 0)
+ return log_error_errno(errno, KEXEC" is not available: %m");
+
r = find_esp_and_warn(arg_esp_path, false, &where, NULL, NULL, NULL, NULL);
if (r == -ENOKEY) /* find_esp_and_warn() doesn't warn about this case */
return log_error_errno(r, "Cannot find the ESP partition mount point.");
@@ -3511,9 +3522,12 @@ static int load_kexec_kernel(void) {
if (!options)
return log_oom();
- log_debug("%s kexec kernel %s initrd %s options \"%s\".",
- arg_dry_run ? "Would load" : "loading",
- kernel, initrd, options);
+ log_full(arg_quiet ? LOG_DEBUG : LOG_INFO,
+ "%s "KEXEC" --load \"%s\" --append \"%s\"%s%s%s",
+ arg_dry_run ? "Would run" : "Running",
+ kernel,
+ options,
+ initrd ? " --initrd \"" : NULL, strempty(initrd), initrd ? "\"" : "");
if (arg_dry_run)
return 0;
@@ -3521,7 +3535,6 @@ static int load_kexec_kernel(void) {
if (r < 0)
return r;
if (r == 0) {
-
const char* const args[] = {
KEXEC,
"--load", kernel,
@@ -3534,7 +3547,13 @@ static int load_kexec_kernel(void) {
_exit(EXIT_FAILURE);
}
- return wait_for_terminate_and_check("kexec", pid, WAIT_LOG);
+ r = wait_for_terminate_and_check("kexec", pid, WAIT_LOG);
+ if (r < 0)
+ return r;
+ if (r > 0)
+ /* Command failed */
+ return -EPROTO;
+ return 0;
}
static int set_exit_code(uint8_t code) {
@@ -3592,7 +3611,9 @@ static int start_special(int argc, char *argv[], void *userdata) {
} else if (a == ACTION_KEXEC) {
r = load_kexec_kernel();
- if (r < 0)
+ if (r < 0 && arg_force >= 1)
+ log_notice("Failed to load kexec kernel, continuing without.");
+ else if (r < 0)
return r;
} else if (a == ACTION_EXIT && argc > 1) {
diff --git a/src/sysusers/sysusers.c b/src/sysusers/sysusers.c
index cd273ef2c9..43952e5f19 100644
--- a/src/sysusers/sysusers.c
+++ b/src/sysusers/sysusers.c
@@ -396,6 +396,7 @@ static const char* default_shell(uid_t uid) {
static int write_temporary_passwd(const char *passwd_path, FILE **tmpfile, char **tmpfile_path) {
_cleanup_fclose_ FILE *original = NULL, *passwd = NULL;
_cleanup_(unlink_and_freep) char *passwd_tmp = NULL;
+ struct passwd *pw = NULL;
Iterator iterator;
Item *i;
int r;
@@ -409,7 +410,6 @@ static int write_temporary_passwd(const char *passwd_path, FILE **tmpfile, char
original = fopen(passwd_path, "re");
if (original) {
- struct passwd *pw;
r = sync_rights(original, passwd);
if (r < 0)
@@ -430,6 +430,11 @@ static int write_temporary_passwd(const char *passwd_path, FILE **tmpfile, char
}
errno = 0;
+
+ /* Make sure we keep the NIS entries (if any) at the end. */
+ if (IN_SET(pw->pw_name[0], '+', '-'))
+ break;
+
if (putpwent(pw, passwd) < 0)
return errno ? -errno : -EIO;
@@ -467,6 +472,19 @@ static int write_temporary_passwd(const char *passwd_path, FILE **tmpfile, char
if (putpwent(&n, passwd) != 0)
return errno ? -errno : -EIO;
}
+ errno = 0;
+
+ /* Append the remaining NIS entries if any */
+ while (pw) {
+ errno = 0;
+ if (putpwent(pw, passwd) < 0)
+ return errno ? -errno : -EIO;
+
+ errno = 0;
+ pw = fgetpwent(original);
+ }
+ if (!IN_SET(errno, 0, ENOENT))
+ return -errno;
r = fflush_and_check(passwd);
if (r < 0)
@@ -482,6 +500,7 @@ static int write_temporary_passwd(const char *passwd_path, FILE **tmpfile, char
static int write_temporary_shadow(const char *shadow_path, FILE **tmpfile, char **tmpfile_path) {
_cleanup_fclose_ FILE *original = NULL, *shadow = NULL;
_cleanup_(unlink_and_freep) char *shadow_tmp = NULL;
+ struct spwd *sp = NULL;
Iterator iterator;
long lstchg;
Item *i;
@@ -498,7 +517,6 @@ static int write_temporary_shadow(const char *shadow_path, FILE **tmpfile, char
original = fopen(shadow_path, "re");
if (original) {
- struct spwd *sp;
r = sync_rights(original, shadow);
if (r < 0)
@@ -519,6 +537,11 @@ static int write_temporary_shadow(const char *shadow_path, FILE **tmpfile, char
}
errno = 0;
+
+ /* Make sure we keep the NIS entries (if any) at the end. */
+ if (IN_SET(sp->sp_namp[0], '+', '-'))
+ break;
+
if (putspent(sp, shadow) < 0)
return errno ? -errno : -EIO;
@@ -551,6 +574,19 @@ static int write_temporary_shadow(const char *shadow_path, FILE **tmpfile, char
if (putspent(&n, shadow) != 0)
return errno ? -errno : -EIO;
}
+ errno = 0;
+
+ /* Append the remaining NIS entries if any */
+ while (sp) {
+ errno = 0;
+ if (putspent(sp, shadow) < 0)
+ return errno ? -errno : -EIO;
+
+ errno = 0;
+ sp = fgetspent(original);
+ }
+ if (!IN_SET(errno, 0, ENOENT))
+ return -errno;
r = fflush_sync_and_check(shadow);
if (r < 0)
@@ -567,6 +603,7 @@ static int write_temporary_group(const char *group_path, FILE **tmpfile, char **
_cleanup_fclose_ FILE *original = NULL, *group = NULL;
_cleanup_(unlink_and_freep) char *group_tmp = NULL;
bool group_changed = false;
+ struct group *gr = NULL;
Iterator iterator;
Item *i;
int r;
@@ -580,7 +617,6 @@ static int write_temporary_group(const char *group_path, FILE **tmpfile, char **
original = fopen(group_path, "re");
if (original) {
- struct group *gr;
r = sync_rights(original, group);
if (r < 0)
@@ -604,6 +640,12 @@ static int write_temporary_group(const char *group_path, FILE **tmpfile, char **
return -EEXIST;
}
+ errno = 0;
+
+ /* Make sure we keep the NIS entries (if any) at the end. */
+ if (IN_SET(gr->gr_name[0], '+', '-'))
+ break;
+
r = putgrent_with_members(gr, group);
if (r < 0)
return r;
@@ -635,6 +677,19 @@ static int write_temporary_group(const char *group_path, FILE **tmpfile, char **
group_changed = true;
}
+ errno = 0;
+
+ /* Append the remaining NIS entries if any */
+ while (gr) {
+ errno = 0;
+ if (putgrent(gr, group) != 0)
+ return errno > 0 ? -errno : -EIO;
+
+ errno = 0;
+ gr = fgetgrent(original);
+ }
+ if (!IN_SET(errno, 0, ENOENT))
+ return -errno;
r = fflush_sync_and_check(group);
if (r < 0)
diff --git a/src/test/test-cgroup-util.c b/src/test/test-cgroup-util.c
index c4163fc3a9..9ef7c97c74 100644
--- a/src/test/test-cgroup-util.c
+++ b/src/test/test-cgroup-util.c
@@ -408,9 +408,15 @@ static void test_cg_tests(void) {
static void test_cg_get_keyed_attribute(void) {
_cleanup_free_ char *val = NULL;
char *vals3[3] = {}, *vals3a[3] = {};
- int i;
+ int i, r;
- assert_se(cg_get_keyed_attribute("cpu", "/init.scope", "no_such_file", STRV_MAKE("no_such_attr"), &val) == -ENOENT);
+ r = cg_get_keyed_attribute("cpu", "/init.scope", "no_such_file", STRV_MAKE("no_such_attr"), &val);
+ if (r == -ENOMEDIUM) {
+ log_info_errno(r, "Skipping most of %s, /sys/fs/cgroup not accessible: %m", __func__);
+ return;
+ }
+
+ assert_se(r == -ENOENT);
assert_se(val == NULL);
if (access("/sys/fs/cgroup/init.scope/cpu.stat", R_OK) < 0) {
diff --git a/src/test/test-fileio.c b/src/test/test-fileio.c
index 286867d2dc..c6128c9091 100644
--- a/src/test/test-fileio.c
+++ b/src/test/test-fileio.c
@@ -406,7 +406,7 @@ static void test_capeff(void) {
static void test_write_string_stream(void) {
char fn[] = "/tmp/test-write_string_stream-XXXXXX";
- _cleanup_fclose_ FILE *f = NULL;
+ FILE *f = NULL;
int fd;
char buf[64];
@@ -416,8 +416,9 @@ static void test_write_string_stream(void) {
f = fdopen(fd, "r");
assert_se(f);
assert_se(write_string_stream(f, "boohoo", 0) < 0);
+ f = safe_fclose(f);
- f = freopen(fn, "r+", f);
+ f = fopen(fn, "r+");
assert_se(f);
assert_se(write_string_stream(f, "boohoo", 0) == 0);
@@ -425,8 +426,9 @@ static void test_write_string_stream(void) {
assert_se(fgets(buf, sizeof(buf), f));
assert_se(streq(buf, "boohoo\n"));
+ f = safe_fclose(f);
- f = freopen(fn, "w+", f);
+ f = fopen(fn, "w+");
assert_se(f);
assert_se(write_string_stream(f, "boohoo", WRITE_STRING_FILE_AVOID_NEWLINE) == 0);
@@ -435,6 +437,7 @@ static void test_write_string_stream(void) {
assert_se(fgets(buf, sizeof(buf), f));
printf(">%s<", buf);
assert_se(streq(buf, "boohoo"));
+ f = safe_fclose(f);
unlink(fn);
}
@@ -607,7 +610,8 @@ static void test_writing_tmpfile(void) {
char name[] = "/tmp/test-systemd_writing_tmpfile.XXXXXX";
_cleanup_free_ char *contents = NULL;
size_t size;
- int fd, r;
+ int r;
+ _cleanup_close_ int fd = -1;
struct iovec iov[3];
iov[0] = IOVEC_MAKE_STRING("abc\n");
diff --git a/src/test/test-mount-util.c b/src/test/test-mount-util.c
index c95baa81a7..5f2ad7c719 100644
--- a/src/test/test-mount-util.c
+++ b/src/test/test-mount-util.c
@@ -80,12 +80,8 @@ static void test_mnt_id(void) {
int mnt_id = PTR_TO_INT(k), mnt_id2;
r = path_get_mnt_id(p, &mnt_id2);
- if (r == -EOPNOTSUPP) { /* kernel or file system too old? */
- log_debug("%s doesn't support mount IDs\n", p);
- continue;
- }
- if (IN_SET(r, -EACCES, -EPERM)) {
- log_debug("Can't access %s\n", p);
+ if (r < 0) {
+ log_debug_errno(r, "Failed to get the mnt id of %s: %m\n", p);
continue;
}
diff --git a/src/test/test-process-util.c b/src/test/test-process-util.c
index 0e5a9d811d..1a0164e601 100644
--- a/src/test/test-process-util.c
+++ b/src/test/test-process-util.c
@@ -193,6 +193,8 @@ static void test_get_process_cmdline_harder(void) {
assert_se(pid == 0);
assert_se(unshare(CLONE_NEWNS) >= 0);
+ assert_se(mount(NULL, "/", NULL, MS_PRIVATE|MS_REC, NULL) >= 0);
+
fd = mkostemp(path, O_CLOEXEC);
assert_se(fd >= 0);
diff --git a/src/timesync/timesyncd-manager.c b/src/timesync/timesyncd-manager.c
index a6d336c461..7743036023 100644
--- a/src/timesync/timesyncd-manager.c
+++ b/src/timesync/timesyncd-manager.c
@@ -1006,6 +1006,7 @@ static int manager_network_read_link_servers(Manager *m) {
_cleanup_strv_free_ char **ntp = NULL;
ServerName *n, *nx;
char **i;
+ bool changed = false;
int r;
assert(m);
@@ -1031,14 +1032,18 @@ static int manager_network_read_link_servers(Manager *m) {
r = server_name_new(m, NULL, SERVER_LINK, *i);
if (r < 0)
goto clear;
+
+ changed = true;
}
}
LIST_FOREACH_SAFE(names, n, nx, m->link_servers)
- if (n->marked)
+ if (n->marked) {
server_name_free(n);
+ changed = true;
+ }
- return 0;
+ return changed;
clear:
manager_flush_server_names(m, SERVER_LINK);
@@ -1047,14 +1052,14 @@ clear:
static int manager_network_event_handler(sd_event_source *s, int fd, uint32_t revents, void *userdata) {
Manager *m = userdata;
- bool connected, online;
+ bool changed, connected, online;
int r;
assert(m);
sd_network_monitor_flush(m->network_monitor);
- manager_network_read_link_servers(m);
+ changed = !!manager_network_read_link_servers(m);
/* check if the machine is online */
online = network_is_online();
@@ -1066,7 +1071,7 @@ static int manager_network_event_handler(sd_event_source *s, int fd, uint32_t re
log_info("No network connectivity, watching for changes.");
manager_disconnect(m);
- } else if (!connected && online) {
+ } else if (!connected && online && changed) {
log_info("Network configuration changed, trying to establish connection.");
if (m->current_server_address)
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
index f1890f3261..cbacfae66b 100644
--- a/src/tmpfiles/tmpfiles.c
+++ b/src/tmpfiles/tmpfiles.c
@@ -1293,7 +1293,7 @@ static int write_one_file(Item *i, const char *path) {
fd = safe_close(fd);
-done:
+ done:
if (stat(path, &st) < 0)
return log_error_errno(errno, "stat(%s) failed: %m", path);
@@ -1666,7 +1666,7 @@ static int create_item(Item *i) {
r = symlink_atomic(i->argument, i->path);
mac_selinux_create_file_clear();
- if (IN_SET(r, -EEXIST, -ENOTEMPTY)) {
+ if (IN_SET(r, -EISDIR, -EEXIST, -ENOTEMPTY)) {
r = rm_rf(i->path, REMOVE_ROOT|REMOVE_PHYSICAL);
if (r < 0)
return log_error_errno(r, "rm -fr %s failed: %m", i->path);
@@ -2729,7 +2729,7 @@ static int read_config_files(char **config_dirs, char **args, bool *invalid_conf
}
int main(int argc, char *argv[]) {
- int r, k;
+ int r, k, r_process = 0;
ItemArray *a;
Iterator iterator;
_cleanup_strv_free_ char **config_dirs = NULL;
@@ -2776,7 +2776,7 @@ int main(int argc, char *argv[]) {
t = strv_join(config_dirs, "\n\t");
if (t)
- log_debug("Looking for configuration files in (higher priority first:\n\t%s", t);
+ log_debug("Looking for configuration files in (higher priority first):\n\t%s", t);
}
/* If command line arguments are specified along with --replace, read all
@@ -2792,22 +2792,20 @@ int main(int argc, char *argv[]) {
if (r < 0)
goto finish;
-
-
/* The non-globbing ones usually create things, hence we apply
* them first */
ORDERED_HASHMAP_FOREACH(a, items, iterator) {
k = process_item_array(a);
- if (k < 0 && r == 0)
- r = k;
+ if (k < 0 && r_process == 0)
+ r_process = k;
}
/* The globbing ones usually alter things, hence we apply them
* second. */
ORDERED_HASHMAP_FOREACH(a, globs, iterator) {
k = process_item_array(a);
- if (k < 0 && r == 0)
- r = k;
+ if (k < 0 && r_process == 0)
+ r_process = k;
}
finish:
@@ -2822,10 +2820,12 @@ finish:
mac_selinux_finish();
- if (r < 0)
+ if (r < 0 || ERRNO_IS_RESOURCE(-r_process))
return EXIT_FAILURE;
else if (invalid_config)
return EX_DATAERR;
+ else if (r_process < 0)
+ return EX_CANTCREAT;
else
return EXIT_SUCCESS;
}
diff --git a/src/udev/collect/collect.c b/src/udev/collect/collect.c
index 2821640e93..c8fa47b3d7 100644
--- a/src/udev/collect/collect.c
+++ b/src/udev/collect/collect.c
@@ -58,7 +58,7 @@ static inline struct _mate *node_to_mate(struct udev_list_node *node)
return container_of(node, struct _mate, node);
}
-noreturn static void sig_alrm(int signo)
+_noreturn_ static void sig_alrm(int signo)
{
exit(4);
}
diff --git a/src/udev/udev-builtin-input_id.c b/src/udev/udev-builtin-input_id.c
index 02b86cce23..4d5b1233f1 100644
--- a/src/udev/udev-builtin-input_id.c
+++ b/src/udev/udev-builtin-input_id.c
@@ -195,15 +195,23 @@ static bool test_pointers(struct udev_device *dev,
has_mt_coordinates = false;
is_direct = test_bit(INPUT_PROP_DIRECT, bitmask_props);
has_touch = test_bit(BTN_TOUCH, bitmask_key);
+
/* joysticks don't necessarily have buttons; e. g.
* rudders/pedals are joystick-like, but buttonless; they have
- * other fancy axes. Others have buttons only but no axes. */
- for (button = BTN_JOYSTICK; button < BTN_DIGI && !has_joystick_axes_or_buttons; button++)
- has_joystick_axes_or_buttons = test_bit(button, bitmask_key);
- for (button = BTN_TRIGGER_HAPPY1; button <= BTN_TRIGGER_HAPPY40 && !has_joystick_axes_or_buttons; button++)
- has_joystick_axes_or_buttons = test_bit(button, bitmask_key);
- for (button = BTN_DPAD_UP; button <= BTN_DPAD_RIGHT && !has_joystick_axes_or_buttons; button++)
- has_joystick_axes_or_buttons = test_bit(button, bitmask_key);
+ * other fancy axes. Others have buttons only but no axes.
+ *
+ * The BTN_JOYSTICK range starts after the mouse range, so a mouse
+ * with more than 16 buttons runs into the joystick range (e.g. Mad
+ * Catz Mad Catz M.M.O.TE). Skip those.
+ */
+ if (!test_bit(BTN_JOYSTICK - 1, bitmask_key)) {
+ for (button = BTN_JOYSTICK; button < BTN_DIGI && !has_joystick_axes_or_buttons; button++)
+ has_joystick_axes_or_buttons = test_bit(button, bitmask_key);
+ for (button = BTN_TRIGGER_HAPPY1; button <= BTN_TRIGGER_HAPPY40 && !has_joystick_axes_or_buttons; button++)
+ has_joystick_axes_or_buttons = test_bit(button, bitmask_key);
+ for (button = BTN_DPAD_UP; button <= BTN_DPAD_RIGHT && !has_joystick_axes_or_buttons; button++)
+ has_joystick_axes_or_buttons = test_bit(button, bitmask_key);
+ }
for (axis = ABS_RX; axis < ABS_PRESSURE && !has_joystick_axes_or_buttons; axis++)
has_joystick_axes_or_buttons = test_bit(axis, bitmask_abs);
diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c
index 36994360c7..6efa712930 100644
--- a/src/udev/udev-builtin-net_id.c
+++ b/src/udev/udev-builtin-net_id.c
@@ -297,7 +297,7 @@ static int dev_pci_slot(struct udev_device *dev, struct netnames *names) {
if (snprintf_ok(str, sizeof str, "%s/%s/address", slots, dent->d_name) &&
read_one_line_file(str, &address) >= 0)
/* match slot address with device by stripping the function */
- if (streq(address, udev_device_get_sysname(names->pcidev)))
+ if (startswith(udev_device_get_sysname(names->pcidev), address))
hotplug_slot = i;
if (hotplug_slot > 0)
diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index 615c4ed3e2..daaab6417a 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -1676,12 +1676,16 @@ int main(int argc, char *argv[]) {
if (arg_children_max == 0) {
cpu_set_t cpu_set;
+ unsigned long mem_limit;
arg_children_max = 8;
if (sched_getaffinity(0, sizeof(cpu_set), &cpu_set) == 0)
arg_children_max += CPU_COUNT(&cpu_set) * 2;
+ mem_limit = physical_memory() / (128LU*1024*1024);
+ arg_children_max = MAX(10U, MIN(arg_children_max, mem_limit));
+
log_debug("set children_max to %u", arg_children_max);
}
diff --git a/src/udev/v4l_id/v4l_id.c b/src/udev/v4l_id/v4l_id.c
index 05f31d479e..8c525c1139 100644
--- a/src/udev/v4l_id/v4l_id.c
+++ b/src/udev/v4l_id/v4l_id.c
@@ -68,9 +68,11 @@ int main(int argc, char *argv[]) {
printf("ID_V4L_VERSION=2\n");
printf("ID_V4L_PRODUCT=%s\n", v2cap.card);
printf("ID_V4L_CAPABILITIES=:");
- if ((v2cap.capabilities & V4L2_CAP_VIDEO_CAPTURE) > 0)
+ if ((v2cap.capabilities & V4L2_CAP_VIDEO_CAPTURE) > 0 ||
+ (v2cap.capabilities & V4L2_CAP_VIDEO_CAPTURE_MPLANE) > 0)
printf("capture:");
- if ((v2cap.capabilities & V4L2_CAP_VIDEO_OUTPUT) > 0)
+ if ((v2cap.capabilities & V4L2_CAP_VIDEO_OUTPUT) > 0 ||
+ (v2cap.capabilities & V4L2_CAP_VIDEO_OUTPUT_MPLANE) > 0)
printf("video_output:");
if ((v2cap.capabilities & V4L2_CAP_VIDEO_OVERLAY) > 0)
printf("video_overlay:");
diff --git a/units/system-update-cleanup.service.in b/units/system-update-cleanup.service.in
index 84d16f608e..58baab3023 100644
--- a/units/system-update-cleanup.service.in
+++ b/units/system-update-cleanup.service.in
@@ -14,6 +14,7 @@ After=system-update.target
DefaultDependencies=no
Conflicts=shutdown.target
Before=shutdown.target
+SuccessAction=reboot
# system-update-generator uses laccess("/system-update"), while a plain
# ConditionPathExists=/system-update uses access("/system-update"), so
@@ -32,4 +33,3 @@ ConditionPathIsSymbolicLink=|/system-update
[Service]
Type=oneshot
ExecStart=/bin/rm -fv /system-update
-SuccessAction=reboot
diff --git a/units/systemd-tmpfiles-setup-dev.service.in b/units/systemd-tmpfiles-setup-dev.service.in
index 6a6ebed955..1d06b369d4 100644
--- a/units/systemd-tmpfiles-setup-dev.service.in
+++ b/units/systemd-tmpfiles-setup-dev.service.in
@@ -20,4 +20,4 @@ ConditionCapability=CAP_SYS_MODULE
Type=oneshot
RemainAfterExit=yes
ExecStart=@rootbindir@/systemd-tmpfiles --prefix=/dev --create --boot
-SuccessExitStatus=65
+SuccessExitStatus=65 73
diff --git a/units/systemd-tmpfiles-setup.service.in b/units/systemd-tmpfiles-setup.service.in
index 0410d0bfd8..384be59481 100644
--- a/units/systemd-tmpfiles-setup.service.in
+++ b/units/systemd-tmpfiles-setup.service.in
@@ -20,4 +20,4 @@ RefuseManualStop=yes
Type=oneshot
RemainAfterExit=yes
ExecStart=@rootbindir@/systemd-tmpfiles --create --remove --boot --exclude-prefix=/dev
-SuccessExitStatus=65
+SuccessExitStatus=65 73