Skip to contentSkip to conversation

Define _POSIX_C_SOURCE if undefined

PATCH New Khem Raj 1 participant 1 message Jan 13, 2016 MD RAID

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/1 Define _POSIX_C_SOURCE if undefined

typecast second argument of connect() API to use struct sockaddr*

---
 config.c | 3 +++
 mdmon.c  | 2 +-
 msg.c    | 2 +-
 3 files changed, 5 insertions(+), 2 deletions(-)
config.c +3 -0
index c58c8fe..b308b6c 100644
@@ -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"
mdmon.c +1 -1
index ee12b7c..e4b73d9 100644
@@ -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;
 	}
msg.c +1 -1
index 754630b..45cd450 100644
@@ -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;
 	}
Signature · 1 line
2.7.0