]> git.ipfire.org Git - thirdparty/systemd.git/commit
conf-files: fix an empty root handling in conf_files_list_strv()
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 28 Jun 2025 01:25:05 +0000 (10:25 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 29 Jun 2025 20:35:03 +0000 (05:35 +0900)
commit9000db5f6eec813f2d853d197de088c06a99ba42
tree7d0d736e7f10a01ce0cdb050826a2b20376a1207
parent8ce463639a67b68ba5b4cec50cf36e138a9b0f0e
conf-files: fix an empty root handling in conf_files_list_strv()

Before 50c81130b69d04288f50217bede709bac6ca2b1a, the function used
chase(), hence if root is an empty string, each config directory made
prefixed with the current working directory if it is relative. See
implementation of chase().

With 50c81130b69d04288f50217bede709bac6ca2b1a, conf_files_list_strv()
internally uses chaseat(), hence each config directory is not prefixed
anymore even if it is relative.

To restore the previous behavior, this makes
- if root is an empty string, prefix each config directories with the
  current working directory if relative.
- if root is relative, make it absolute to make the prefixed results also
  absolute, and debugging logs show absolute paths.
- use chaseat_prefix_root() to prefix the results, for safety.

Follow-ups for 50c81130b69d04288f50217bede709bac6ca2b1a.
src/basic/conf-files.c
src/test/test-conf-files.c