diff options
author | Hannes Reinecke <hare@suse.de> | 2010-05-27 15:02:56 +0200 |
---|---|---|
committer | Hannes Reinecke <hare@suse.de> | 2011-05-03 13:58:02 +0200 |
commit | 35180dcf95be5414c3a92cd308230cfefbfb48ad (patch) | |
tree | 9e9987986666af0b3e8d204f1d464c64f3559316 | |
parent | c0cb8a6e9ff82002b8793ae8b468202d75d10dc0 (diff) | |
download | multipath-tools-35180dcf95be5414c3a92cd308230cfefbfb48ad.tar.gz |
libmultipath: remove strcmp_chomp()
We can as well sanitize the strings before calling
find_path_by_devt(), thus removing the need for
strcmp_chomp() altogether.
Signed-off-by: Hannes Reinecke <hare@suse.de>
-rw-r--r-- | libmultipath/configure.c | 1 | ||||
-rw-r--r-- | libmultipath/structs.c | 4 | ||||
-rw-r--r-- | libmultipath/util.c | 20 | ||||
-rw-r--r-- | libmultipath/util.h | 1 |
4 files changed, 3 insertions, 23 deletions
diff --git a/libmultipath/configure.c b/libmultipath/configure.c index 95406a5..520b5eb 100644 --- a/libmultipath/configure.c +++ b/libmultipath/configure.c @@ -644,6 +644,7 @@ get_refwwid (char * dev, enum devtypes dev_type, vector pathvec) } if (dev_type == DEV_DEVT) { + strchop(dev); pp = find_path_by_devt(pathvec, dev); if (!pp) { diff --git a/libmultipath/structs.c b/libmultipath/structs.c index 25a5a0e..a84c509 100644 --- a/libmultipath/structs.c +++ b/libmultipath/structs.c @@ -319,7 +319,7 @@ find_path_by_dev (vector pathvec, char * dev) return NULL; vector_foreach_slot (pathvec, pp, i) - if (!strcmp_chomp(pp->dev, dev)) + if (!strcmp(pp->dev, dev)) return pp; condlog(3, "%s: not found in pathvec", dev); @@ -336,7 +336,7 @@ find_path_by_devt (vector pathvec, char * dev_t) return NULL; vector_foreach_slot (pathvec, pp, i) - if (!strcmp_chomp(pp->dev_t, dev_t)) + if (!strcmp(pp->dev_t, dev_t)) return pp; condlog(3, "%s: not found in pathvec", dev_t); diff --git a/libmultipath/util.c b/libmultipath/util.c index ebe06dc..2b24885 100644 --- a/libmultipath/util.c +++ b/libmultipath/util.c @@ -9,26 +9,6 @@ #define PARAMS_SIZE 255 -int -strcmp_chomp(char *str1, char *str2) -{ - int i; - char s1[PARAMS_SIZE],s2[PARAMS_SIZE]; - - if(!str1 || !str2) - return 1; - - strncpy(s1, str1, PARAMS_SIZE); - strncpy(s2, str2, PARAMS_SIZE); - - for (i=strlen(s1)-1; i >=0 && isspace(s1[i]); --i) ; - s1[++i] = '\0'; - for (i=strlen(s2)-1; i >=0 && isspace(s2[i]); --i) ; - s2[++i] = '\0'; - - return(strcmp(s1,s2)); -} - void strchop(char *str) { diff --git a/libmultipath/util.h b/libmultipath/util.h index 52f2578..ceab398 100644 --- a/libmultipath/util.h +++ b/libmultipath/util.h @@ -1,7 +1,6 @@ #ifndef _UTIL_H #define _UTIL_H -int strcmp_chomp(char *, char *); void strchop(char *); void basenamecpy (char * src, char * dst); int filepresent (char * run); |