[systemd-devel] [RFC PATCH] condition: add ConditionFileContains=
Lennart Poettering
lennart at poettering.net
Thu Jul 11 15:41:10 PDT 2013
On Thu, 11.07.13 19:18, Karol Lewandowski (k.lewandowsk at samsung.com) wrote:
> Add ability to test if given file contains specified value.
> File and expected value are given as one argument separated
> by colon (":"), i.e.
>
> ConditionFileContains=/sys/module/sn/parameters/enabled:1
Hmm, I don't like the naming. If this is called "Contains" I'd always
assume that it does substring matching or so?
Maybe ConditionFileContentsIs= or so?
I don#t really like the : as separator. Either "=" or a space sounds better.
> + path = strdup(parameter);
> + if (!path) {
> + log_oom();
> + return false;
> + }
> +
> + p = strchr(path, ':');
> + if (!p)
> + return false;
> +
> + *(p++) = '\0';
I'd prefer if we'd have a path_is_absolute() check here, and immeidately
fail with a warning if the path isn't absolute.
Lennart
--
Lennart Poettering - Red Hat, Inc.
More information about the systemd-devel
mailing list