liminix

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 8ec00f171016b1cec85bd88710b84970ddcf3292
parent 6a6dd32dea75fd3cb6ebee061af757a9d4d51666
Author: Daniel Barlow <dan@telent.net>
Date:   Sun, 15 Sep 2024 21:37:04 +0100

improve error message

Diffstat:
Mpkgs/logshipper/logtee.c | 5+++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/pkgs/logshipper/logtee.c b/pkgs/logshipper/logtee.c @@ -10,6 +10,7 @@ #include <signal.h> #include <sys/socket.h> #include <sys/un.h> +#include <errno.h> int open_shipper_socket(char *pathname) { int fd; @@ -22,7 +23,7 @@ int open_shipper_socket(char *pathname) { fd = socket(AF_LOCAL, SOCK_STREAM, 0); if(fd >= 0) { if(connect(fd, (struct sockaddr *) &sa, sizeof sa)) { - perror("connect socket"); + error(0, errno, "connect socket \"%s\"", pathname); return -1; } int flags = fcntl(fd, F_GETFL); @@ -82,7 +83,7 @@ int main(int argc, char * argv[]) { if(fds[2].revents & (POLLERR|POLLHUP)) { close(fds[2].fd); fds[2].fd = -1; - (void) write(1, stop_cookie , strlen(stop_cookie)); + (void) write(1, stop_cookie, strlen(stop_cookie)); }; }; } else {