X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Futils%2Fliblustreapi.c;h=6fbf5d614219c3308156d94ef5cf9bce1edaf7f3;hp=1614dd87002bbc548ab97069bb6a35966558cec6;hb=87a333f85f29fe989997638ee2b7fd5c3a53608b;hpb=88cbf2754651d051288a2b68ff0cf27aea6b502a diff --git a/lustre/utils/liblustreapi.c b/lustre/utils/liblustreapi.c index 1614dd87..6fbf5d6 100644 --- a/lustre/utils/liblustreapi.c +++ b/lustre/utils/liblustreapi.c @@ -606,8 +606,19 @@ int llapi_search_mounts(const char *pathname, int index, char *mntdir, /* Given a path, find the corresponding Lustre fsname */ int llapi_search_fsname(const char *pathname, char *fsname) { + char *path = (char*)pathname, buf[PATH_MAX + 1]; + + if (pathname[0] != '/') { /* Need a absolute path */ + memset(buf, '\0', sizeof(buf)); + if (realpath(pathname, buf) == NULL) { + llapi_err(LLAPI_MSG_ERROR, "pathname '%s' cannot expand", + pathname); + return -EINVAL; + } + path = buf; + } return get_root_path(WANT_FSNAME | WANT_ERROR, fsname, NULL, - (char *)pathname, -1); + path, -1); } /* return the first file matching this pattern */