libseat: log error when failing to open socket

The most common pain point I've seen with people trying out seat is
forgetting to add themselves to whatever group the distro has chosen
to own the socket.

Logging this error and path of the socket should make it easier to tell
why things aren't working.
This commit is contained in:
Isaac Freund 2020-11-21 16:59:01 +01:00 committed by Kenny Levinsen
parent 2185e8f180
commit 3c80a9db96

View file

@ -75,7 +75,7 @@ static int seatd_connect(void) {
strncpy(addr.unix.sun_path, path, sizeof addr.unix.sun_path - 1); strncpy(addr.unix.sun_path, path, sizeof addr.unix.sun_path - 1);
socklen_t size = offsetof(struct sockaddr_un, sun_path) + strlen(addr.unix.sun_path); socklen_t size = offsetof(struct sockaddr_un, sun_path) + strlen(addr.unix.sun_path);
if (connect(fd, &addr.generic, size) == -1) { if (connect(fd, &addr.generic, size) == -1) {
log_debugf("Could not connect to socket: %s", strerror(errno)); log_errorf("Could not connect to socket %s: %s", path, strerror(errno));
close(fd); close(fd);
return -1; return -1;
}; };