@@ -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);
@@ -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
@@ -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);
Some sysfs attributes may contain trailing spaces, which only serve to confuse matters. So strip them before continuing. Signed-off-by: Hannes Reinecke <hare@suse.de> --- libmultipath/discovery.c | 2 +- libmultipath/util.c | 3 ++- libmultipath/util.h | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-)