aboutsummaryrefslogtreecommitdiff
path: root/seatd-launch
diff options
context:
space:
mode:
authorKenny Levinsen <kl@kl.wtf>2021-09-16 00:10:56 +0200
committerKenny Levinsen <kl@kl.wtf>2021-09-16 00:55:43 +0200
commitebf512c2bf74b1286d2f243c2f78daa64114d81d (patch)
treef4feb216ef0aee2cdff8652f8574ff55644bdc6f /seatd-launch
parent907b75de1ae5ec415a99889faecaf05b36bea31e (diff)
seatd-launch: Specify exact environment to seatd
The parent environment might contain nasty things. Create a new environment for the seatd process containing only the environment variables we care about. For now, that's only SEATD_LOGLEVEL.
Diffstat (limited to 'seatd-launch')
-rw-r--r--seatd-launch/seatd-launch.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/seatd-launch/seatd-launch.c b/seatd-launch/seatd-launch.c
index 7b41bb6..69ca86a 100644
--- a/seatd-launch/seatd-launch.c
+++ b/seatd-launch/seatd-launch.c
@@ -71,8 +71,16 @@ int main(int argc, char *argv[]) {
char pipebuf[16] = {0};
snprintf(pipebuf, sizeof pipebuf, "%d", fds[1]);
+ char *env[2] = {NULL, NULL};
+ char loglevelbuf[32] = {0};
+ char *cur_loglevel = getenv("SEATD_LOGLEVEL");
+ if (cur_loglevel != NULL) {
+ snprintf(loglevelbuf, sizeof loglevelbuf, "SEATD_LOGLEVEL=%s", cur_loglevel);
+ env[0] = loglevelbuf;
+ }
+
char *command[] = {"seatd", "-n", pipebuf, "-s", sockpath, NULL};
- execv(SEATD_INSTALLPATH, command);
+ execve(SEATD_INSTALLPATH, command, env);
perror("Could not start seatd");
_exit(1);
}