[systemd-devel] [PATCHv2] "-" prefix for InaccessibleDirectories and ReadOnlyDirectories
Zbigniew Jędrzejewski-Szmek
zbyszek at in.waw.pl
Fri Aug 23 09:32:28 PDT 2013
On Wed, Aug 21, 2013 at 04:43:55PM +0200, Maciej Wereski wrote:
> - effect.</para></listitem>
> + effect.</para>
> + <para>If paths in <varname>ReadOnlyDirectories=</varname>
> + or <varname>InaccessibleDirectories=</varname>
> + start with "-", then errors will be
> + supressed if path doesn't exist.</para></listitem>
I reworded it a bit. We also have <literal> tag for literals.
> - if (!path_is_absolute(rvalue)) {
> - log_syntax(unit, LOG_ERR, filename, line, EINVAL,
> - "Not an absolute path, ignoring: %s", rvalue);
> - return 0;
> - }
> + if (streq(lvalue, "InaccessibleDirectories") || streq(lvalue, "ReadOnlyDirectories")) {
> + if (!path_is_absolute(rvalue) && (rvalue[0] != '-' || !path_is_absolute(rvalue+1)))
> + goto fail;
> + } else if (!path_is_absolute(rvalue))
> + goto fail;
I also reworded this part bit. 'goto cleanup's is something that we're trying to
erradicate, without making the code uglier.
> - if (!path_is_absolute(n)) {
> - log_syntax(unit, LOG_ERR, filename, line, EINVAL,
> - "Not an absolute path, ignoring: %s", rvalue);
> - continue;
> - }
> + if (streq(lvalue, "InaccessibleDirectories") || streq(lvalue, "ReadOnlyDirectories")) {
> + if (!path_is_absolute(n) && (n[0] != '-' || !path_is_absolute(n+1)))
> + goto fail;
> + } else if (!path_is_absolute(n))
> + goto fail;
Here you changed continue to return 0, which changes the semantics.
Applied, with fixups.
Zbyszek
More information about the systemd-devel
mailing list