Skip to contentSkip to conversation

Fix build failure with fomat-security. Specify the format type.

PATCH In review Ritesh Raj Sarraf 3 participants 5 messages Mar 9, 2014 – Mar 10, 2014 Device mapper

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 Fix build failure with fomat-security. Specify the format type.

cc -g -O2 -fPIE -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -Wunused -Wstrict-prototypes -fPIC -DLIB_STRING=\"lib\" -I.. -c -o rdac.o rdac.c
rdac.c: In function 'libcheck_check':
rdac.c:311:3: error: format not a string literal and no format arguments [-Werror=format-security]
MSG(c, (inqfail) ? MSG_RDAC_DOWN_TYPE("inquiry failed") :
^
rdac.c:311:3: error: format not a string literal and no format arguments [-Werror=format-security]
cc1: some warnings being treated as errors
make[2]: *** [rdac.o] Error 1

---
 libmultipath/checkers/rdac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
libmultipath/checkers/rdac.c +1 -1
index e0b2ea4..00e3c44 100644
@@ -308,7 +308,7 @@ libcheck_check (struct checker * c)
 done:
 	switch (ret) {
 	case PATH_DOWN:
-		MSG(c, (inqfail) ? MSG_RDAC_DOWN_TYPE("inquiry failed") :
+		MSG(c, "%s", (inqfail) ? MSG_RDAC_DOWN_TYPE("inquiry failed") :
 			checker_msg_string(&inq));
 		break;
 	case PATH_UP:
Signature · 1 line
1.9.0
#1 lore raw

PATCH 2/3 Minor spelling error fixes

---
 multipath/multipath.conf.5 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
multipath/multipath.conf.5 +2 -2
index cf5bec0..1a904e9 100644
@@ -426,7 +426,7 @@ The \fIWorld Wide Identification\fR of a device.
 Regular expression of the device nodes to be excluded.
 .TP
 .B property
-Regular expresion of the udev property to be excluded.
+Regular expression of the udev property to be excluded.
 .TP
 .B device
 Subsection for the device description. This subsection recognizes the
@@ -453,7 +453,7 @@ The following keywords are recognized:
 The \fIWorld Wide Identification\fR of a device.
 .TP
 .B property
-Regular expresion of the udev property to be whitelisted. Defaults to
+Regular expression of the udev property to be whitelisted. Defaults to
 .I (ID_WWN|ID_SCSI_VPD)
 .TP
 .B devnode
Signature · 1 line
1.9.0
#2 lore raw

PATCH 3/3 Library with an exit()

In reply to Ritesh Raj Sarraf
---
 libmpathpersist/mpath_persist.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
libmpathpersist/mpath_persist.c +5 -4
index bd30125..6b6901e 100644
@@ -585,11 +585,12 @@ int send_prout_activepath(char * dev, int rq_servact, int rq_scope,
 	rc = pthread_create(&thread, &attr, mpath_prout_pthread_fn, (void *)(&param));
 	if (rc){
 		condlog (3, "%s: failed to create thread %d", dev, rc);
-		exit(-1);
 	}
-	/* Free attribute and wait for the other threads */
-	pthread_attr_destroy(&attr);
-	rc = pthread_join(thread, NULL);
+	else {
+		/* Free attribute and wait for the other threads */
+		pthread_attr_destroy(&attr);
+		rc = pthread_join(thread, NULL);
+	}
 
 	return (param.status);
 }
Signature · 1 line
1.9.0
#3 lore raw

Re: [PATCH 3/3] Library with an exit()

Quoted 16 lines · Ritesh Raj Sarraf
---
 libmpathpersist/mpath_persist.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
libmpathpersist/mpath_persist.c +0 -2
index bd30125..6b6901e 100644
@@ -585,11 +585,12 @@ int send_prout_activepath(char * dev, int rq_servact, int rq_scope,
 	rc = pthread_create(&thread, &attr, mpath_prout_pthread_fn, (void *)(&param));
 	if (rc){
 		condlog (3, "%s: failed to create thread %d", dev, rc);
-		exit(-1);
 	}
-	/* Free attribute and wait for the other threads */

libmpathpersist/mpath_persist.c int send_prout_activepath(char * dev, int rq_servact, int rq_scope, · line 596

Quoted 10 lines
libmpathpersist/mpath_persist.c +5 -2
-	pthread_attr_destroy(&attr);
-	rc = pthread_join(thread, NULL);
+	else {
+		/* Free attribute and wait for the other threads */
+		pthread_attr_destroy(&attr);
+		rc = pthread_join(thread, NULL);
+	}
 
 	return (param.status);
 }

pthread_attr_destroy() should also be called if pthread_create() fails.

Bart.

#4 lore raw

Re: [PATCH 3/3] Library with an exit()

Ritesh,

do you want to send an updated patch addressing Bart's comment ? Patch 1/3 and 2/3 of your set are applied.

Thanks,
Christophe Varoqui

Quoted 33 lines · Bart Van Assche
Quoted 16 lines · Ritesh Raj Sarraf
---
 libmpathpersist/mpath_persist.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
libmpathpersist/mpath_persist.c +0 -2
index bd30125..6b6901e 100644
@@ -585,11 +585,12 @@ int send_prout_activepath(char * dev, int rq_servact, int rq_scope,
      rc = pthread_create(&thread, &attr, mpath_prout_pthread_fn, (void *)(&param));
      if (rc){
              condlog (3, "%s: failed to create thread %d", dev, rc);
-             exit(-1);
      }
-     /* Free attribute and wait for the other threads */

libmpathpersist/mpath_persist.c int send_prout_activepath(char * dev, int rq_servact, int rq_scope, · line 596

Quoted 10 lines
libmpathpersist/mpath_persist.c +5 -2
-     pthread_attr_destroy(&attr);
-     rc = pthread_join(thread, NULL);
+     else {
+             /* Free attribute and wait for the other threads */
+             pthread_attr_destroy(&attr);
+             rc = pthread_join(thread, NULL);
+     }
 
      return (param.status);
 }

pthread_attr_destroy() should also be called if pthread_create() fails.

Bart.