]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/shared/generator.c
tree-wide: use path_join() instead of prefix_roota() in various cases
authorLennart Poettering <lennart@poettering.net>
Mon, 22 Aug 2022 09:38:58 +0000 (11:38 +0200)
committerLuca Boccassi <luca.boccassi@gmail.com>
Mon, 22 Aug 2022 18:15:29 +0000 (19:15 +0100)
commit8e7e4a730ba40bbc46c9d1e84207fd35781ca05a
treed3afeaddba38bf96f3df5a08fa7f40aba7a8d2eb
parent8ef6106de4ebe633db76deccd257800b5aa8f177
tree-wide: use path_join() instead of prefix_roota() in various cases

prefix_roota() is something we should stop using. It is bad for three
reasons:

1. As it names suggests it's supposed to be used when working relative
   to some root directory, but given it doesn't follow symlinks (and
   instead just stupidly joins paths) it is not a good choice for that.

2. More often than not it is currently used with inputs under control of
   the user, and that is icky given it typically allocates memory on the
   stack.

3. It's a redundant interface, where chase_symlinks() and path_join()
   already exist as better, safer interfaces.

Hence, let's start moving things from prefix_roota() to path_join() for
the cases where that's appropriate.
src/core/cgroup.c
src/delta/delta.c
src/gpt-auto-generator/gpt-auto-generator.c
src/libsystemd/sd-device/sd-device.c
src/libsystemd/sd-journal/sd-journal.c
src/portable/portable.c
src/shared/generator.c
src/sysv-generator/sysv-generator.c