diff options
author | Kenny Levinsen <kl@kl.wtf> | 2021-09-16 00:10:56 +0200 |
---|---|---|
committer | Kenny Levinsen <kl@kl.wtf> | 2021-09-16 00:55:43 +0200 |
commit | ebf512c2bf74b1286d2f243c2f78daa64114d81d (patch) | |
tree | f4feb216ef0aee2cdff8652f8574ff55644bdc6f | |
parent | 907b75de1ae5ec415a99889faecaf05b36bea31e (diff) | |
download | seatd-ebf512c2bf74b1286d2f243c2f78daa64114d81d.tar.xz |
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.
-rw-r--r-- | seatd-launch/seatd-launch.c | 10 |
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); } |