diff options
author | Kenny Levinsen <kl@kl.wtf> | 2021-08-08 18:22:17 +0200 |
---|---|---|
committer | Kenny Levinsen <kl@kl.wtf> | 2021-08-08 18:22:17 +0200 |
commit | 309650aa4d4be1310b20e7293a3bc0c47aeecf0e (patch) | |
tree | 02d19c5d1c59d067188c0fd7fb6997412accf721 /seatd | |
parent | 2cfc56d5ed87440c58ed7fa538c3a3dbf73fbfc2 (diff) |
seatd: Use path in chmod/chown operations
c8b3a22d4ef0f69c3d22f0ec1170b89c93ef1dc3 snuck in a change which
converts chown/chmod to fchown/fchmod using the socket fd. This appears
to succeed under Linux, but fails with EINVAL on FreeBSD. As the error
handling in this area was flawed, CI failed to catch the regression.
Partially revert c8b3a22d4ef0f69c3d22f0ec1170b89c93ef1dc3 to fix the
regression on FreeBSD.
Diffstat (limited to 'seatd')
-rw-r--r-- | seatd/seatd.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/seatd/seatd.c b/seatd/seatd.c index 4587e50..053d44b 100644 --- a/seatd/seatd.c +++ b/seatd/seatd.c @@ -40,12 +40,12 @@ static int open_socket(const char *path, int uid, int gid) { goto error; } if (uid != -1 || gid != -1) { - if (fchown(fd, uid, gid) == -1) { + if (chown(path, uid, gid) == -1) { log_errorf("Could not chown socket to uid %d, gid %d: %s", uid, gid, strerror(errno)); goto error; } - if (fchmod(fd, 0770) == -1) { + if (chmod(path, 0770) == -1) { log_errorf("Could not chmod socket: %s", strerror(errno)); goto error; } @@ -148,7 +148,7 @@ int main(int argc, char *argv[]) { int socket_fd = open_socket(socket_path, uid, gid); if (socket_fd == -1) { - log_errorf("Could not create server socket: %s", strerror(errno)); + log_error("Could not create server socket"); server_finish(&server); return 1; } |