From 369af8f9e4797be55c4b95facd50dd7cc20565d1 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Fri, 6 Aug 2021 08:23:03 +0000 Subject: seatd-launch: check for getpwuid errors --- seatd-launch/seatd-launch.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'seatd-launch') diff --git a/seatd-launch/seatd-launch.c b/seatd-launch/seatd-launch.c index cf9f93d..acec145 100644 --- a/seatd-launch/seatd-launch.c +++ b/seatd-launch/seatd-launch.c @@ -33,7 +33,12 @@ int main(int argc, char *argv[]) { char pipebuf[8]; sprintf(pipebuf, "%d", fds[1]); + struct passwd *user = getpwuid(getuid()); + if (!user) { + perror("getpwuid failed"); + _exit(1); + } // TODO: Make seatd accept the numeric UID execlp("seatd", "seatd", "-n", pipebuf, "-u", user->pw_name, "-s", sockbuf, NULL); -- cgit v1.2.3