On Wed, 18.02.15 18:17, Cristian Rodríguez (crrodrig...@opensuse.org) wrote:
> >From ee8e4f440def745b6f0655b897e65d48321e46c5 Mon Sep 17 00:00:00 2001 > From: =?UTF-8?q?Cristian=20Rodr=C3=ADguez?= <crrodrig...@opensuse.org> > Date: Wed, 18 Feb 2015 18:09:16 -0300 > Subject: [PATCH] tmpfiles: implement specifier substitution for file > "argument" > > Only for L and C types where it makes sense. > --- > src/tmpfiles/tmpfiles.c | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c > index 88ba7e4..6de477b 100644 > --- a/src/tmpfiles/tmpfiles.c > +++ b/src/tmpfiles/tmpfiles.c > @@ -1568,6 +1568,18 @@ static int parse_line(const char *fname, unsigned > line, const char *buffer) { > } > } > > + if(IN_SET(i.type, CREATE_SYMLINK, COPY_FILES)) { I figure it makes sense on more than these, for example the ones that write strings to files. Also, there's a space missing after the "if" and before the first "(". > + if(i.argument) { Similar here. > + _cleanup_free_ char *resolved_iarg = NULL; > + r = specifier_printf(i.argument, specifier_table, > NULL, &resolved_iarg); > + if(r < 0) > + return log_error_errno(r, "[%s:%u] Failed to > replace specifiers: %s", fname, line, path); > + r = free_and_strdup(&i.argument, resolved_iarg); > + if(r < 0) > + return log_oom(); No need to duplicate the already allocated string again. Just assign resolved_iarg to i.argument, and free that before. Lennart -- Lennart Poettering, Red Hat _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel