tmpfiles: fix crash with NULL in arg_root and other fixes and tests
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 19 Dec 2018 22:05:48 +0000 (23:05 +0100)
committerThe Plumber <50238977+systemd-rhel-bot@users.noreply.github.com>
Mon, 8 Jun 2020 09:02:19 +0000 (11:02 +0200)
commit3569b29eb8b082229dd97b8aae60bbe4d2f96ef5
tree4945b4c322a29b7bc229c66ebdb3c5ead1b1f018
parent65a066aae68744e889c114cee56dff5b48d872df
tmpfiles: fix crash with NULL in arg_root and other fixes and tests

The function to replacement paths into the configuration file list was borked.
Apart from the crash with empty root prefix, it would incorrectly handle the
case where root *was* set, and the replacement file was supposed to override
an existing file.

prefix_root is used instead of path_join because prefix_root removes duplicate
slashes (when --root=dir/ is used).

A test is added.

Fixes #11124.

(cherry picked from commit 082bb1c59bd4300bcdc08488c94109680cfadf57)

Resolves: #1836024
src/basic/conf-files.c
src/test/test-conf-files.c