X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fsysctl%2Fsysctl.c;h=035e0ec321c5a4d951fd91e7761fc6430edb0f29;hb=f274ece0f76b5709408821e317e87aef76123db6;hp=e77f496089f760393adcb62dec02948630ae1831;hpb=0187f62bb5f785c22952e79c55ef0fdb87f1ad65;p=elogind.git diff --git a/src/sysctl/sysctl.c b/src/sysctl/sysctl.c index e77f49608..035e0ec32 100644 --- a/src/sysctl/sysctl.c +++ b/src/sysctl/sysctl.c @@ -167,14 +167,18 @@ static int parse_file(const char *path, bool ignore_enoent) { r = hashmap_put(sysctl_options, property, new_value); if (r < 0) { - if (r == -EEXIST) + if (r == -EEXIST) { + /* ignore this "error" to avoid returning it + * for the function when this is the last key + * in the file being parsed. */ + r = 0; log_debug("Skipping previously assigned sysctl variable %s", property); - else + } else log_error("Failed to add sysctl variable %s to hashmap: %s", property, strerror(-r)); free(property); free(new_value); - if (r != -EEXIST) + if (r != 0) goto finish; } }