From e2107b406c5222d2c2583a053e217a2b1b75b3f4 Mon Sep 17 00:00:00 2001 From: minhdiep Date: Thu, 1 Jul 2010 18:02:46 -0600 Subject: [PATCH] b=12197 The mount point passed into mtab should be the absolute path Convert the mount point to real path. i=Johann --- lustre/utils/mount_lustre.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lustre/utils/mount_lustre.c b/lustre/utils/mount_lustre.c index 24b042c..6b7cfe5 100644 --- a/lustre/utils/mount_lustre.c +++ b/lustre/utils/mount_lustre.c @@ -494,7 +494,8 @@ set_params: int main(int argc, char *const argv[]) { char default_options[] = ""; - char *usource, *source, *target, *ptr; + char *usource, *source; + char target[PATH_MAX] = {'\0'}; char *options, *optcopy, *orig_options = default_options; int i, nargs = 3, opt, rc, flags, optlen; static struct option long_opt[] = { @@ -562,11 +563,11 @@ int main(int argc, char *const argv[]) usage(stderr); } - target = argv[optind + 1]; - ptr = target + strlen(target) - 1; - while ((ptr > target) && (*ptr == '/')) { - *ptr = 0; - ptr--; + if (realpath(argv[optind + 1], target) == NULL) { + rc = errno; + fprintf(stderr, "warning: %s: cannot resolve: %s\n", + argv[optind + 1], strerror(errno)); + return rc; } if (verbose) { -- 1.8.3.1