diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2013-09-06 17:13:34 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2013-09-06 17:13:34 +0200 |
commit | 467cc0f6c2ea7f005d55bb12605910d1c61c911c (patch) | |
tree | 3903e1fce8a4f43015d4cf3f34a0e817e197cb5a | |
parent | 02c1cb4ce21dca6cc63545cd5bd7ed621ed61529 (diff) | |
download | fastd-467cc0f6c2ea7f005d55bb12605910d1c61c911c.tar fastd-467cc0f6c2ea7f005d55bb12605910d1c61c911c.zip |
Change directory to / when privileges are dropped or the user is changed
-rw-r--r-- | src/fastd.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/fastd.c b/src/fastd.c index e5c1364..f281744 100644 --- a/src/fastd.c +++ b/src/fastd.c @@ -715,6 +715,9 @@ static void write_pid(fastd_context_t *ctx, pid_t pid) { } static void set_user(fastd_context_t *ctx) { + if (chdir("/")) + pr_error(ctx, "can't chdir to `/': %s", strerror(errno)); + if (ctx->conf->user || ctx->conf->group) { if (setgid(ctx->conf->gid) < 0) exit_errno(ctx, "setgid"); |