]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Add casts for the addr arg of connect and bind
authorKhem Raj <raj.khem@gmail.com>
Thu, 14 Jan 2016 06:32:39 +0000 (22:32 -0800)
committerNeilBrown <neilb@suse.com>
Thu, 14 Jan 2016 21:36:45 +0000 (08:36 +1100)
glibc allows the addr arg to connect and socket to be any of a number
of 'sockaddr_*' types, but musl requires 'const struct sockaddr *'
which is in line with open group specs.  So add casts to allow
compilation with musl.

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: NeilBrown <neilb@suse.com>
mdmon.c
msg.c

diff --git a/mdmon.c b/mdmon.c
index ee12b7c788ac0fc969499204343db8f39b124843..e4b73d96b96c6482df7915daeb03b67b580f93fd 100644 (file)
--- a/mdmon.c
+++ b/mdmon.c
@@ -235,7 +235,7 @@ static int make_control_sock(char *devname)
        addr.sun_family = PF_LOCAL;
        strcpy(addr.sun_path, path);
        umask(077); /* ensure no world write access */
-       if (bind(sfd, &addr, sizeof(addr)) < 0) {
+       if (bind(sfd, (struct sockaddr*)&addr, sizeof(addr)) < 0) {
                close(sfd);
                return -1;
        }
diff --git a/msg.c b/msg.c
index 754630b92a51a1a285a8e53e875cfaee3534e452..45cd45040a6126c22eb2bb2bfdf193cc7357790d 100644 (file)
--- a/msg.c
+++ b/msg.c
@@ -170,7 +170,7 @@ int connect_monitor(char *devname)
 
        addr.sun_family = PF_LOCAL;
        strcpy(addr.sun_path, path);
-       if (connect(sfd, &addr, sizeof(addr)) < 0) {
+       if (connect(sfd, (struct sockaddr*)&addr, sizeof(addr)) < 0) {
                close(sfd);
                return -1;
        }