Hannes,
FYI, related to this patch,
commit 3e7763345a31e81318b70d7af68902984312f624
Author: Christophe Varoqui <christophe.varoqui@xxxxxxxxxxx>
Date: Fri Dec 13 23:10:27 2013 +0100
[libmultipath] Fix a compilation warning
Now that we chop the sysfs attribute strings, the size returned
by strlcpy is not used anymore. Remove the variable to tame
the compiler warning.
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index ccd3b62..b7470f8 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -143,7 +143,6 @@ path_discovery (vector pathvec, struct config * conf, int flag)
extern ssize_t \
sysfs_get_##fname (struct udev_device * udev, char * buff, size_t len) \
{ \
- ssize_t ret; \
const char * attr; \
const char * devname; \
\
@@ -163,7 +162,7 @@ sysfs_get_##fname (struct udev_device * udev, char * buff, size_t len) \
devname, #fname); \
return -EINVAL; \
} \
- ret = strlcpy(buff, attr, len); \
+ strlcpy(buff, attr, len); \
return strchop(buff); \
}
Best regards,
Christophe Varoqui
On Fri, Dec 13, 2013 at 1:14 PM, Hannes Reinecke <hare@xxxxxxx> wrote:
--Some sysfs attributes may contain trailing spaces, which only
serve to confuse matters. So strip them before continuing.
Signed-off-by: Hannes Reinecke <hare@xxxxxxx>
---
libmultipath/discovery.c | 2 +-
libmultipath/util.c | 3 ++-
libmultipath/util.h | 2 +-
3 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index d5557d9..d519c02 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -164,7 +164,7 @@ sysfs_get_##fname (struct udev_device * udev, char * buff, size_t len) \
return -EINVAL; \
} \
ret = strlcpy(buff, attr, len); \
- return ret; \
+ return strchop(buff); \
}
declare_sysfs_get_str(devtype);
diff --git a/libmultipath/util.c b/libmultipath/util.c
index a9f5939..e6fd11d 100644
--- a/libmultipath/util.c
+++ b/libmultipath/util.c
@@ -10,13 +10,14 @@
#include "vector.h"
#include "structs.h"
-void
+size_t
strchop(char *str)
{
int i;
for (i=strlen(str)-1; i >=0 && isspace(str[i]); --i) ;
str[++i] = '\0';
+ return strlen(str);
}
int
diff --git a/libmultipath/util.h b/libmultipath/util.h
index 44184a1..7b67dff 100644
--- a/libmultipath/util.h
+++ b/libmultipath/util.h
@@ -1,7 +1,7 @@
#ifndef _UTIL_H
#define _UTIL_H
-void strchop(char *);
+size_t strchop(char *);
int basenamecpy (const char * src, char * dst, int);
int filepresent (char * run);
int get_word (char * sentence, char ** word);
--
1.8.1.4
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel
-- dm-devel mailing list dm-devel@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/dm-devel