unit: set default working directory to the user's home directory when running in user mode

This commit is contained in:
Lennart Poettering
2012-07-16 12:44:42 +02:00
parent d05c5031ad
commit e06c73cc91
7 changed files with 37 additions and 2 deletions
+13
View File
@@ -2817,6 +2817,19 @@ int unit_add_mount_links(Unit *u) {
return 0;
}
int unit_patch_working_directory(Unit *u, ExecContext *c) {
assert(u);
assert(c);
if (u->manager->running_as != MANAGER_USER)
return 0;
if (c->working_directory)
return 0;
return get_home_dir(&c->working_directory);
}
static const char* const unit_active_state_table[_UNIT_ACTIVE_STATE_MAX] = {
[UNIT_ACTIVE] = "active",
[UNIT_RELOADING] = "reloading",