Cast `struct sockaddr_un*` properly
authorequal-l2 <eng.equall2@gmail.com>
Mon, 8 Feb 2021 00:29:39 +0000 (09:29 +0900)
committerequal-l2 <eng.equall2@gmail.com>
Mon, 8 Feb 2021 00:34:48 +0000 (09:34 +0900)
Because of `-Werror`, the difference in pointer types makes the whole
build fail.

src/remote.c

index f7a5a25..66e9f3b 100644 (file)
@@ -264,7 +264,7 @@ static RemoteConnection *remote_server_open(const gchar *path)
        addr.sun_family = AF_UNIX;
        sun_path_len = MIN(strlen(path) + 1, UNIX_PATH_MAX);
        strncpy(addr.sun_path, path, sun_path_len);
-       if (bind(fd, &addr, sizeof(addr)) == -1 ||
+       if (bind(fd, (struct sockaddr*)&addr, sizeof(addr)) == -1 ||
            listen(fd, REMOTE_SERVER_BACKLOG) == -1)
                {
                log_printf("error subscribing to socket: %s\n", strerror(errno));
@@ -313,7 +313,7 @@ static RemoteConnection *remote_client_open(const gchar *path)
        addr.sun_family = AF_UNIX;
        sun_path_len = MIN(strlen(path) + 1, UNIX_PATH_MAX);
        strncpy(addr.sun_path, path, sun_path_len);
-       if (connect(fd, &addr, sizeof(addr)) == -1)
+       if (connect(fd, (struct sockaddr*)&addr, sizeof(addr)) == -1)
                {
                DEBUG_1("error connecting to socket: %s", strerror(errno));
                close(fd);