summaryrefslogtreecommitdiff
path: root/src/core/unit.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-07-16 12:44:42 +0200
committerLennart Poettering <lennart@poettering.net>2012-07-16 12:44:42 +0200
commite06c73cc91e02a1a3dffdb0976fef754f1109e74 (patch)
tree5a3cd2c0424fe64c3a589ce44a1a054d20fbf655 /src/core/unit.c
parentd05c5031ad4c528fe6bbfed289519edb9f13180a (diff)
unit: set default working directory to the user's home directory when running in user mode
Diffstat (limited to 'src/core/unit.c')
-rw-r--r--src/core/unit.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/core/unit.c b/src/core/unit.c
index 673af13c3e..7994f7038e 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -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",