X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fshared%2Finstall.c;h=a2f84f893e43255f7ce674d2f6e09fc1a193eb9a;hb=28622e8f5b28412d97bf2f3a5df49c419be1e2c5;hp=4f7179309e80eb056b7bbb8bd18232927f98d5d0;hpb=de228aabc833901e7c75aab8d62e58229e2a8bfc;p=elogind.git diff --git a/src/shared/install.c b/src/shared/install.c index 4f7179309..a2f84f893 100644 --- a/src/shared/install.c +++ b/src/shared/install.c @@ -1076,7 +1076,10 @@ static int unit_file_load( return -ENOMEM; } - r = config_parse(NULL, path, f, NULL, config_item_table_lookup, (void*) items, true, true, info); + r = config_parse(NULL, path, f, + NULL, + config_item_table_lookup, items, + true, true, false, info); if (r < 0) return r; @@ -1776,7 +1779,7 @@ UnitFileState unit_file_get_state( int unit_file_query_preset(UnitFileScope scope, const char *root_dir, const char *name) { _cleanup_strv_free_ char **files = NULL; - char **i; + char **p; int r; assert(scope >= 0); @@ -1804,17 +1807,10 @@ int unit_file_query_preset(UnitFileScope scope, const char *root_dir, const char if (r < 0) return r; - STRV_FOREACH(i, files) { - _cleanup_free_ char *buf = NULL; + STRV_FOREACH(p, files) { _cleanup_fclose_ FILE *f; - const char *p; - - if (root_dir) - p = buf = strjoin(root_dir, "/", *i, NULL); - else - p = *i; - f = fopen(p, "re"); + f = fopen(*p, "re"); if (!f) { if (errno == ENOENT) continue; @@ -1881,7 +1877,7 @@ int unit_file_preset( assert(scope >= 0); assert(scope < _UNIT_FILE_SCOPE_MAX); - assert(mode < _UNIT_FILE_PRESET_MODE_MAX); + assert(mode < _UNIT_FILE_PRESET_MAX); r = lookup_paths_init_from_scope(&paths, scope, root_dir); if (r < 0) @@ -1949,7 +1945,7 @@ int unit_file_preset_all( assert(scope >= 0); assert(scope < _UNIT_FILE_SCOPE_MAX); - assert(mode < _UNIT_FILE_PRESET_MODE_MAX); + assert(mode < _UNIT_FILE_PRESET_MAX); r = lookup_paths_init_from_scope(&paths, scope, root_dir); if (r < 0) @@ -2186,7 +2182,7 @@ static const char* const unit_file_change_type_table[_UNIT_FILE_CHANGE_TYPE_MAX] DEFINE_STRING_TABLE_LOOKUP(unit_file_change_type, UnitFileChangeType); -static const char* const unit_file_preset_mode_table[_UNIT_FILE_PRESET_MODE_MAX] = { +static const char* const unit_file_preset_mode_table[_UNIT_FILE_PRESET_MAX] = { [UNIT_FILE_PRESET_FULL] = "full", [UNIT_FILE_PRESET_ENABLE_ONLY] = "enable-only", [UNIT_FILE_PRESET_DISABLE_ONLY] = "disable-only",