X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fshared%2Finstall.c;h=2555a36c0a9226c5cfa9f95631b408b717c937df;hb=f10dda3b82dd493eada52bcc52b790a1cc1094e6;hp=7fb352cffff26e4510240faf012d50a1e9002153;hpb=7584d236eac91f9b7128b1eb08bddf18be2bce9f;p=elogind.git diff --git a/src/shared/install.c b/src/shared/install.c index 7fb352cff..2555a36c0 100644 --- a/src/shared/install.c +++ b/src/shared/install.c @@ -956,6 +956,33 @@ static int config_parse_also( return 0; } +static int config_parse_user( + const char *filename, + unsigned line, + const char *section, + const char *lvalue, + int ltype, + const char *rvalue, + void *data, + void *userdata) { + + InstallInfo *i = data; + char* printed; + + assert(filename); + assert(lvalue); + assert(rvalue); + + printed = install_full_printf(i, rvalue); + if (!printed) + return -ENOMEM; + + free(i->user); + i->user = printed; + + return 0; +} + static int unit_file_load( InstallContext *c, InstallInfo *info, @@ -967,6 +994,7 @@ static int unit_file_load( { "Install", "WantedBy", config_parse_strv, 0, &info->wanted_by }, { "Install", "RequiredBy", config_parse_strv, 0, &info->required_by }, { "Install", "Also", config_parse_also, 0, c }, + { "Exec", "User", config_parse_user, 0, info }, { NULL, NULL, NULL, 0, NULL } }; @@ -1630,7 +1658,7 @@ int unit_file_query_preset(UnitFileScope scope, const char *name) { assert(name); if (scope == UNIT_FILE_SYSTEM) - r = conf_files_list(&files, ".preset", + r = conf_files_list(&files, ".preset", NULL, "/etc/systemd/system-preset", "/usr/local/lib/systemd/system-preset", "/usr/lib/systemd/system-preset", @@ -1639,7 +1667,7 @@ int unit_file_query_preset(UnitFileScope scope, const char *name) { #endif NULL); else if (scope == UNIT_FILE_GLOBAL) - r = conf_files_list(&files, ".preset", + r = conf_files_list(&files, ".preset", NULL, "/etc/systemd/user-preset", "/usr/local/lib/systemd/user-preset", "/usr/lib/systemd/user-preset",