aboutsummaryrefslogtreecommitdiff
path: root/seatd-launch
diff options
context:
space:
mode:
authorKenny Levinsen <kl@kl.wtf>2022-02-26 20:25:22 +0100
committerKenny Levinsen <kl@kl.wtf>2022-02-26 22:25:27 +0100
commit0d6bdf4f01e5be10c29dd786f2531b96e1d935cd (patch)
treee22953c2104de4e05214ebf5a6859cd224642b3a /seatd-launch
parent466efea49bc6ab5672555c31f04b39741c502c70 (diff)
seatd: Remove runtime socket path configuration
Configurable socket paths exist mainly to facilitate multiple parallel seatd instances. However, the only valid use-case for running multiple instances of seatd is testing during development, which can just as well be done by changing SEATD_DEFAULTPATH at compile-time for test builds. Remove the command-line argument in seatd for runtime configuration of socket path, hardcode the socket path in seatd-launch, and change seatd unlink/chmod/chown code to not run when started by seatd-launch. This means that seatd-launch will now fail to start seatd if another seatd instance is already running. The unlink code still runs when seatd is started normally to assist in system crash recovery, but this may be removed later if we deem it unnecessary.
Diffstat (limited to 'seatd-launch')
-rw-r--r--seatd-launch/seatd-launch.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/seatd-launch/seatd-launch.c b/seatd-launch/seatd-launch.c
index f8ab8d4..329ccef 100644
--- a/seatd-launch/seatd-launch.c
+++ b/seatd-launch/seatd-launch.c
@@ -46,9 +46,6 @@ int main(int argc, char *argv[]) {
}
char **command = &argv[optind];
- char sockpath[32];
- snprintf(sockpath, sizeof sockpath, "/tmp/seatd.%d.sock", getpid());
-
int readiness_pipe[2];
if (pipe(readiness_pipe) == -1) {
perror("Could not create pipe");
@@ -67,7 +64,7 @@ int main(int argc, char *argv[]) {
snprintf(pipebuf, sizeof pipebuf, "%d", readiness_pipe[1]);
char *env[1] = {NULL};
- char *command[] = {"seatd", "-n", pipebuf, "-s", sockpath, "-l", loglevel, NULL};
+ char *command[] = {"seatd", "-n", pipebuf, "-l", loglevel, "-z", NULL};
execve(SEATD_INSTALLPATH, command, env);
perror("Could not start seatd");
_exit(1);
@@ -117,11 +114,11 @@ int main(int argc, char *argv[]) {
gid_t gid = getgid();
// Restrict access to the socket to just us
- if (chown(sockpath, uid, gid) == -1) {
+ if (chown(SEATD_DEFAULTPATH, uid, gid) == -1) {
perror("Could not chown seatd socket");
goto error_seatd;
}
- if (chmod(sockpath, 0700) == -1) {
+ if (chmod(SEATD_DEFAULTPATH, 0700) == -1) {
perror("Could not chmod socket");
goto error_seatd;
}
@@ -141,7 +138,7 @@ int main(int argc, char *argv[]) {
perror("Could not fork target process");
goto error_seatd;
} else if (child == 0) {
- setenv("SEATD_SOCK", sockpath, 1);
+ setenv("SEATD_SOCK", SEATD_DEFAULTPATH, 1);
execvp(command[0], command);
perror("Could not start target");
_exit(1);