From 97721b5a152e8173ef4bab17f10e3ec22cc82c1f Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 29 Dec 2015 16:10:07 +0100 Subject: m MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/client.c | 3 ++- src/satd.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/client.c b/src/client.c index 026813b..1bf8440 100644 --- a/src/client.c +++ b/src/client.c @@ -52,6 +52,7 @@ int send_command(enum command cmd, size_t n, const char *restrict msg) { struct sockaddr_un address; + const void *_cvoid; int fd = -1, start = 1, status, outfd, goterr = 0; const char *dir; pid_t pid; @@ -97,7 +98,7 @@ send_command(enum command cmd, size_t n, const char *restrict msg) /* Create socket. */ t ((fd = socket(PF_UNIX, SOCK_STREAM, 0)) == -1); - t (connect(fd, (struct sockaddr *)&address, (socklen_t)sizeof(address)) == -1); + t (connect(fd, (const struct sockaddr *)(_cvoid = &address), (socklen_t)sizeof(address)) == -1); /* Send message. */ t (write(fd, &cmd_, sizeof(cmd_)) < (ssize_t)sizeof(cmd_)); diff --git a/src/satd.c b/src/satd.c index 0a5fb3b..5530b6b 100644 --- a/src/satd.c +++ b/src/satd.c @@ -56,6 +56,7 @@ static int create_socket(struct sockaddr_un *address) { int fd = -1, bound = 0; + const void *_cvoid; const char *dir; int saved_errno; @@ -87,7 +88,7 @@ create_socket(struct sockaddr_un *address) does_not_exist: t ((fd = socket(PF_UNIX, SOCK_STREAM, 0)) == -1); t (fchmod(fd, S_IRWXU) == -1); - t (bind(fd, (struct sockaddr *)address, (socklen_t)sizeof(*address)) == -1); + t (bind(fd, (const struct sockaddr *)(_cvoid = address), (socklen_t)sizeof(*address)) == -1); /* EADDRINUSE just means that the file already exists, not that it is actually used. */ bound = 1; -- cgit v1.2.3-70-g09d2