From e52f3bf8e776454f3caaf92f812a937116a612d2 Mon Sep 17 00:00:00 2001 From: Michal Schmidt Date: Fri, 3 May 2013 17:08:55 +0200 Subject: [PATCH] (F18) sysctl: give files with later names precedence over earlier ones This restores the sysctl.d precedence rules of v197. --- man/sysctl.d.xml | 2 +- src/sysctl/sysctl.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/man/sysctl.d.xml b/man/sysctl.d.xml index 759b8740f..a5868e638 100644 --- a/man/sysctl.d.xml +++ b/man/sysctl.d.xml @@ -92,7 +92,7 @@ alphabetical order, regardless in which of the directories they reside, to guarantee that a specific configuration file takes precedence over another file - with an alphabetically later name, if both files + with an alphabetically earlier name, if both files contain the same variable setting. If the administrator wants to disable a diff --git a/src/sysctl/sysctl.c b/src/sysctl/sysctl.c index db18dd9f6..2735127a7 100644 --- a/src/sysctl/sysctl.c +++ b/src/sysctl/sysctl.c @@ -306,7 +306,9 @@ int main(int argc, char *argv[]) { r = parse_file(sysctl_options, "/etc/sysctl.conf", true); - STRV_FOREACH(f, files) { + /* F18: iterate backwards to preserve v197's behaviour */ + f = files + strv_length(files) - 1; + STRV_FOREACH_BACKWARDS(f, files) { k = parse_file(sysctl_options, *f, true); if (k < 0 && r == 0) r = k;