mdadm: Fix build with musl

Define _POSIX_C_SOURCE if not defined
Add sockaddr_un* to sockaddr* typecast to make compiler happy

(From OE-Core rev: cdb858caadd81d3bdc9ea3fd596e3eab84ec2d81)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Khem Raj 2016-01-13 19:48:47 +00:00 committed by Richard Purdie
parent 67eef116d5
commit 6296c0f9ab
2 changed files with 60 additions and 1 deletions

View File

@ -0,0 +1,59 @@
From d74b02d4653d1ea26029c2528eb93d7268b83eb3 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 13 Jan 2016 07:28:33 +0000
Subject: [PATCH] Define _POSIX_C_SOURCE if undefined
typecast second argument of connect() API to use struct sockaddr*
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
Upstream-Status: Pending
config.c | 3 +++
mdmon.c | 2 +-
msg.c | 2 +-
3 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/config.c b/config.c
index a882ed3..a675688 100644
--- a/config.c
+++ b/config.c
@@ -63,6 +63,9 @@
* but may not wrap over lines
*
*/
+#ifndef _POSIX_C_SOURCE
+#define _POSIX_C_SOURCE 200809L
+#endif
#ifndef CONFFILE
#define CONFFILE "/etc/mdadm.conf"
diff --git a/mdmon.c b/mdmon.c
index ee12b7c..e4b73d9 100644
--- 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 754630b..45cd450 100644
--- 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;
}
--
2.7.0

View File

@ -14,13 +14,13 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/raid/mdadm/${BPN}-${PV}.tar.xz \
file://mdadm-3.3.2_x32_abi_time_t.patch \
file://0001-Fix-typo-in-comparision.patch \
file://mdadm-fix-ptest-build-errors.patch \
file://0001-Define-_POSIX_C_SOURCE-if-undefined.patch \
file://run-ptest \
"
SRC_URI[md5sum] = "7ca8b114710f98f53f20c5787b674a09"
SRC_URI[sha256sum] = "8ae5f45306b873190e91f410709b00e51997b633c072b33f8efd9f7df022ca68"
CFLAGS += "-fno-strict-aliasing"
inherit autotools-brokensep
EXTRA_OEMAKE = 'CHECK_RUN_DIR=0 CXFLAGS="${CFLAGS}"'