From: Hannes Reinecke Date: Thu, 27 May 2010 13:02:56 +0000 (+0200) Subject: libmultipath: remove strcmp_chomp() X-Git-Tag: upstream/0.5.0~106^2~65 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=35180dcf95be5414c3a92cd308230cfefbfb48ad;p=platform%2Fupstream%2Fmultipath-tools.git 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 --- 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);