From 10fd1d46fc842e0a7f0781f7c7312fb2d9a3d04f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 26 Mar 2019 12:46:02 +0100 Subject: [PATCH] shared/install: try even harder to make sure variable is initalized Apparently the fix in a05294ff05923563087b53c1db64816130be3b34 was not sufficient. Let's declare the two arrays as static variables. --- src/shared/install.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/shared/install.c b/src/shared/install.c index 75b6aace0a7..ca52d17e4fe 100644 --- a/src/shared/install.c +++ b/src/shared/install.c @@ -2822,17 +2822,17 @@ static int split_pattern_into_name_and_instances(const char *pattern, char **out } static int presets_find_config(UnitFileScope scope, const char *root_dir, char ***files) { + static const char* const system_dirs[] = {CONF_PATHS("systemd/system-preset"), NULL}; + static const char* const user_dirs[] = {CONF_PATHS_USR("systemd/user-preset"), NULL}; const char* const* dirs; assert(scope >= 0); assert(scope < _UNIT_FILE_SCOPE_MAX); if (scope == UNIT_FILE_SYSTEM) - dirs = (const char* const*) CONF_PATHS_STRV("systemd/system-preset"); - + dirs = system_dirs; else if (IN_SET(scope, UNIT_FILE_GLOBAL, UNIT_FILE_USER)) - dirs = (const char* const*) CONF_PATHS_USR_STRV("systemd/user-preset"); - + dirs = user_dirs; else assert_not_reached("Invalid unit file scope");