[systemd-devel] [PATCHv2] tmpfiles: don't apply --create to /dev twice during boot
Lennart Poettering
lennart at poettering.net
Wed Jul 24 07:21:33 PDT 2013
On Wed, 24.07.13 16:08, Tom Gundersen (teg at jklm.no) wrote:
Indentation is borked. Please fix.
Please use two strv arrays, one prefix array, and one exclude_prefix
array.
And introduce --exclude-prefix= to control the latter.
> ---
>
> v2: use --prefix=-/dev, rather than --prefix=!/dev to avoid problems with shell
>
> src/tmpfiles/tmpfiles.c | 5 ++++-
> units/systemd-tmpfiles-setup.service.in | 2 +-
> 2 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
> index eae993e..39341b4 100644
> --- a/src/tmpfiles/tmpfiles.c
> +++ b/src/tmpfiles/tmpfiles.c
> @@ -1119,9 +1119,12 @@ static int parse_line(const char *fname, unsigned line, const char *buffer) {
>
> path_kill_slashes(i->path);
>
> - if (arg_prefix && !path_startswith(i->path, arg_prefix))
> + if (arg_prefix && arg_prefix[0] != '-' && !path_startswith(i->path, arg_prefix))
> return 0;
>
> + if (arg_prefix && arg_prefix[0] == '-' && path_startswith(i->path, arg_prefix + 1))
> + return 0;
> +
> if (user && !streq(user, "-")) {
> const char *u = user;
>
> diff --git a/units/systemd-tmpfiles-setup.service.in b/units/systemd-tmpfiles-setup.service.in
> index 67c7d4a..0227608 100644
> --- a/units/systemd-tmpfiles-setup.service.in
> +++ b/units/systemd-tmpfiles-setup.service.in
> @@ -21,4 +21,4 @@ ConditionDirectoryNotEmpty=|/run/tmpfiles.d
> [Service]
> Type=oneshot
> RemainAfterExit=yes
> -ExecStart=@rootbindir@/systemd-tmpfiles --create --remove
> +ExecStart=@rootbindir@/systemd-tmpfiles --prefix=-/dev --create --remove
Lennart
--
Lennart Poettering - Red Hat, Inc.
More information about the systemd-devel
mailing list