]> git.ipfire.org Git - thirdparty/systemd.git/commit
udev-rules: make error messages about rules more uniform
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 21 Feb 2016 05:26:32 +0000 (00:26 -0500)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 21 Feb 2016 16:05:11 +0000 (11:05 -0500)
commit19a8e656a96d63c0b0047a84db980dd57ba51df2
tree95194f9ce6c45e665871c422d07f8b42960bc5ea
parentf4850a1d9593fd0f226e507c353ebdd46c069070
udev-rules: make error messages about rules more uniform

Also downgrade non-fatal warnings to log_warning.

Previously rule_add_key() would check the output array and log a cryptic
error and return -1. Most of the time the return value was ignored. This
does not seems right, because the buffer can overflow with enough rules.
It would also check if we have enough space for the *next* rule, even if
there might be not next rule, i.e. off-by-one.

Replace this with a check that we have enough space for a next rule before
we start parsing.

Normally using macros to alter flow is not allowed, but in this case I
think it is worth it, because it allows lots of boilerplate code to be
removed and hides repeated boring parameters, making function logic much
easier to follow.
src/udev/udev-rules.c