diff options
author | Lennart Poettering <lennart@poettering.net> | 2017-11-22 15:03:51 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2017-11-29 12:34:12 +0100 |
commit | 2e59b241ca86b8338c706a7a704d301fde908581 (patch) | |
tree | 4f83e31ad02c6c691ff712a8a4499533c63dd720 /src/core/dbus-slice.h | |
parent | logind: fix sysfs change trigger code (diff) | |
download | systemd-2e59b241ca86b8338c706a7a704d301fde908581.tar.xz systemd-2e59b241ca86b8338c706a7a704d301fde908581.zip |
core: add proper escaping to writing of drop-ins/transient unit files
This majorly refactors the transient unit file and drop-in writing
logic, so that we properly C-escape and specifier-escape (% → %%)
everything we write out, so that when we read it back again, specifiers
are parsed that aren't supposed to be parsed.
This renames unit_write_drop_in() and friends by unit_write_setting().
The name change is supposed to clarify that the functions are not only
used to write drop-in files, but also transient unit files.
The previous "mode" parameter to this function is replaced by a more
generic "flags", which knows additional flags for implicit C-style and
specifier escaping before writing things out. This can cover most
properties where either form of escaping is defined. For the cases where
this isn't sufficient, we add helpers unit_escape_setting() and
unit_concat_strv() for escaping individual strings or strvs properly.
While we are at it, we also prettify generation of transient unit files:
we try to reduce the number of section headers written out: previously
we'd write the right section header our for each setting. With this
change we do so only if the setting lives in a different section than
the one before.
(This should also be considered preparation for when we add proper APIs
to systemd to write normal, persistant unit files through the bus API)
Diffstat (limited to 'src/core/dbus-slice.h')
-rw-r--r-- | src/core/dbus-slice.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/core/dbus-slice.h b/src/core/dbus-slice.h index 5855332126..0c21919ad1 100644 --- a/src/core/dbus-slice.h +++ b/src/core/dbus-slice.h @@ -26,5 +26,5 @@ extern const sd_bus_vtable bus_slice_vtable[]; -int bus_slice_set_property(Unit *u, const char *name, sd_bus_message *message, UnitSetPropertiesMode mode, sd_bus_error *error); +int bus_slice_set_property(Unit *u, const char *name, sd_bus_message *message, UnitWriteFlags flags, sd_bus_error *error); int bus_slice_commit_properties(Unit *u); |