diff --git a/usr.sbin/config/config.5 b/usr.sbin/config/config.5 index fa745feb05f0..c33661f93937 100644 --- a/usr.sbin/config/config.5 +++ b/usr.sbin/config/config.5 @@ -129,8 +129,9 @@ All .Ic env and .Ic envvar -directives will be processed and added to the staitc environment in the order of -appearance. +directives will be processed and added to the static environment in reversed +order of appearance so that later specified variables properly override earlier +specified variables. Note that within .Ar filename , the first appearance of a given variable will be the first one seen by the @@ -150,8 +151,9 @@ All .Ic env and .Ic envvar -directives will be processed and added to the staitc environment in the order of -appearance. +directives will be processed and added to the static environment in reversed +order of appearance so that later specified variables properly override earlier +specified variables. .\" -------- FILES -------- .Pp .It Ic files Ar filename @@ -178,7 +180,9 @@ The file must conform to the syntax specified by .Xr device.hints 5 . Multiple hints lines are allowed. -The resulting hints will be the files concatenated in the order of appearance. +The resulting hints will be the files concatenated in reverse order of +appearance so that hints in later files properly override hints in earlier +files. .\" -------- IDENT -------- .Pp .It Ic ident Ar name diff --git a/usr.sbin/config/config.y b/usr.sbin/config/config.y index c79bc376b788..33658c54a823 100644 --- a/usr.sbin/config/config.y +++ b/usr.sbin/config/config.y @@ -200,7 +200,7 @@ Config_spec: if (hint == NULL) err(EXIT_FAILURE, "calloc"); hint->hint_name = $2; - STAILQ_INSERT_TAIL(&hints, hint, hint_next); + STAILQ_INSERT_HEAD(&hints, hint, hint_next); hintmode = 1; } @@ -360,7 +360,7 @@ newenvvar(char *name, bool is_file) err(EXIT_FAILURE, "calloc"); envvar->env_str = name; envvar->env_is_file = is_file; - STAILQ_INSERT_TAIL(&envvars, envvar, envvar_next); + STAILQ_INSERT_HEAD(&envvars, envvar, envvar_next); envmode = 1; }