Commit graph

18 commits

Author SHA1 Message Date
Kenny Levinsen
9bbdf0f0b8 seatd: Command-line argument for loglevel
SEATD_LOGLEVEL was used to set the loglevel despite already having
getopt in place. Remove the environment variable and make a command-line
argument for it instead.
2022-02-26 19:17:26 +01:00
Kenny Levinsen
3eb0db57bb seatd-launch: Minor readability improvements 2022-02-21 21:33:06 +01:00
Kenny Levinsen
ed90ed62cd seatd-launch: Use snprintf for socket path
We also reduce the size of the buffer from 256 bytes to a much more
reasonable 32 bytes.
2022-02-21 21:27:14 +01:00
Kenny Levinsen
10658dc543 seatd-launch: Remove socket path command line arg
This should not need to be configured, so remove the argument. If
downstream prefers a different folder, the location can be made
compile-time configurable like for seatd itself.
2022-02-21 12:02:31 +01:00
Kenny Levinsen
32d06482d3 seatd-launch: Do not unlink socket path
seatd cleans up after itself and takes care of stale sockets when
applicable, so seatd-launch should not replicate this functionality.
2022-02-21 12:02:31 +01:00
Kenny Levinsen
ebf512c2bf 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.
2021-09-16 00:55:43 +02:00
Kenny Levinsen
907b75de1a seatd-launch: Use absolute path for seatd
We previously used execlp to execute seatd, which had the effect of
searching PATH for the executable. This allowed the caller to control
what executable was run, which is bad if SUID has been set.

Instead, expose the absolute install path for seatd from meason as a
define, and use that in a call to execv.
2021-09-16 00:46:49 +02:00
Simon Ser
4e3b7b3bb6 seatd-launch: print unlink/kill errors
Makes it easier to find out that something went wrong.
2021-09-13 13:40:00 +02:00
Simon Ser
fe600eac2b seatd-launch: exit with status >128 if child is signalled
Mimick shells and exit with a status >128 if our child has been
signalled. Exiting with 128 + signal number is what most shells do
(POSIX only requires them to exit with >128).
2021-09-13 13:39:20 +02:00
Kenny Levinsen
483dbf76fa seatd-launch: Use optind to find the command
The command indexing had not been updated afer the introduction of
getopt, so combining a command with flags would fail.

Add error handling for if no command was specified while we're at it.
2021-09-12 12:06:05 +02:00
Jan Beich
d5c1a7811b seatd-launch: respect PATH when looking for command
$ seatd-launch sway -c /dev/null
Could not start target: No such file or directory
2021-09-12 12:06:05 +02:00
Kenny Levinsen
d1c6bb9a15 seatd-launch: Fix chmod error goto 2021-09-08 20:54:18 +02:00
Kenny Levinsen
17cdbe0ad2 seatd-launch: Set socket permissions directly
Instead of relying on seatd's user/group arguments, which require
turning our UID back into a username, just chmod/chown the socket
ourselves once seatd is ready.

We also reduce the permissions to just user access, instead of user and
group like seatd specifies.
2021-09-08 20:40:09 +02:00
Kenny Levinsen
48727a0b6b seatd-launch: Command line argument support 2021-08-06 23:00:05 +02:00
Simon Ser
369af8f9e4 seatd-launch: check for getpwuid errors 2021-08-06 22:27:42 +02:00
Simon Ser
3a843745c2 seatd-launch: don't use gotos in child processes
While forked (child pid is zero), don't use gotos. These will
execute atexit functions and potentially mess up the stdlib.
Instead, use _exit.
2021-08-06 22:27:42 +02:00
Simon Ser
f2a614dcd3 seatd-launch: propagate child exit status
When the child process exits with a non-zero code or is killed,
return with a non-zero code as well.
2021-08-06 22:27:42 +02:00
Kenny Levinsen
1e98727ae9 seatd-launch: Add seatd launch wrapper
This launch wrapper is used to conveniently start a new seatd instance,
wait for it to be ready, and launch a target application.
2021-08-06 01:29:52 +02:00