Clang fixes
cover Clang fixes
Hi Christophe,
Xose found some issues when building with clang.
Hannes Reinecke (3):
libmultipath/discovery.c: use 'unsigned long' instead of 'unsigned int' libmultipath/parser.c: correctly terminate buffer
multipath: fixup check for out-of-scope maps
libmultipath/discovery.c | 2 +- libmultipath/parser.c | 2 +- multipath/main.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
Signature · 1 line
2.6.6
PATCH 1/3 libmultipath/discovery.c: use 'unsigned long' instead of 'unsigned int'
We should be using 'unsigned long' for the variable preferred.
--- libmultipath/discovery.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
libmultipath/discovery.c +1 -1
@@ -491,7 +491,7 @@ sysfs_get_asymmetric_access_state(struct path *pp, char *buff, int buflen) {struct udev_device *parent = pp->udev;char value[16 ], *eptr; -unsigned int preferred; +unsigned long preferred;while (parent) {const char *subsys =udev_device_get_subsystem (parent);
Signature · 1 line
2.6.6
PATCH 2/3 libmultipath/parser.c: correctly terminate buffer
In reply to Hannes ReineckeThe code would be returning a static NULL buffer instead of terminating the original buffer.
--- libmultipath/parser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
libmultipath/parser.c +1 -1
@@ -171,7 +171,7 @@ snprint_keyword(char *buff, int len, char *fmt, struct keyword *kw, void *data) r = kw->put_multipath_config (conf);if (!r) {/* no output if no value */ - buff ='\0' ; + buff[0 ] ='\0' ;return 0 ; } fwd += r;
Signature · 1 line
2.6.6
PATCH 3/3 multipath: fixup check for out-of-scope maps
In reply to Hannes ReineckeThe 'wwid' in struct multipath is a static array, so a check for the existence of 'wwid' is pointless. We should rather check if the argument 'refwwid' is not NULL and has a length larger then '0'.
--- multipath/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
multipath/main.c +1 -1
@@ -212,7 +212,7 @@ get_dm_mpvec (enum mpath_cmds cmd, vector curmp, vector pathvec, char * refwwid)/* * discard out of scope maps */ -if (mpp->wwid && refwwid && +if (refwwid &&strlen (refwwid) &&strncmp (mpp->wwid, refwwid,WWID_SIZE )) {condlog (3 ,"skip map %s: out of scope" , mpp->alias);free_multipath (mpp,KEEP_PATHS );
Signature · 1 line
2.6.6
Merged.
Thanks.
Quoted 18 lines · Hannes Reinecke
Hi Christophe,
Xose found some issues when building with clang.
Hannes Reinecke (3):
libmultipath/discovery.c: use 'unsigned long' instead of 'unsigned int'libmultipath/parser.c: correctly terminate buffer
multipath: fixup check for out-of-scope mapslibmultipath/discovery.c | 2 +- libmultipath/parser.c | 2 +- multipath/main.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)--
2.6.6