mirror of
https://github.com/neocturne/fastd.git
synced 2025-05-15 04:35:08 +02:00
Change directory to / when privileges are dropped or the user is changed
This commit is contained in:
parent
02c1cb4ce2
commit
467cc0f6c2
1 changed files with 3 additions and 0 deletions
|
@ -715,6 +715,9 @@ static void write_pid(fastd_context_t *ctx, pid_t pid) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_user(fastd_context_t *ctx) {
|
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 (ctx->conf->user || ctx->conf->group) {
|
||||||
if (setgid(ctx->conf->gid) < 0)
|
if (setgid(ctx->conf->gid) < 0)
|
||||||
exit_errno(ctx, "setgid");
|
exit_errno(ctx, "setgid");
|
||||||
|
|
Loading…
Add table
Reference in a new issue