From 11a207f3f6cc6c8b9d6da15dce47ef410b5dd240 Mon Sep 17 00:00:00 2001 From: Sebastien Buisson Date: Mon, 25 Mar 2013 14:52:34 +0100 Subject: [PATCH] LU-3023 build: fix fuzzy logic in get_root_path() Thanks to the call to llapi_is_lustre_mnt(), we are sure that mnt.mnt_fsname contains ":/". And, if no other mountpoint is found (len ==0), there is no reason to abort scanning, so the check and -EINVAL can just be removed. Signed-off-by: Sebastien Buisson Change-Id: Id77c41fbf53782d657034f152f724a3bdc83408c Reviewed-on: http://review.whamcloud.com/5832 Reviewed-by: John Hammond Tested-by: Hudson Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: James Nunez --- lustre/utils/liblustreapi.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lustre/utils/liblustreapi.c b/lustre/utils/liblustreapi.c index 6d0d385..5e76bca 100644 --- a/lustre/utils/liblustreapi.c +++ b/lustre/utils/liblustreapi.c @@ -878,10 +878,11 @@ int get_root_path(int want, char *fsname, int *outfd, char *path, int index) mntlen = strlen(mnt.mnt_dir); ptr = strrchr(mnt.mnt_fsname, '/'); - if (!ptr && !len) { - rc = -EINVAL; - break; - } + /* thanks to the call to llapi_is_lustre_mnt() above, + * we are sure that mnt.mnt_fsname contains ":/", + * so ptr should never be NULL */ + if (ptr == NULL) + continue; ptr++; /* Check the fsname for a match, if given */ -- 1.8.3.1