From 20520e9a2667f63a2630b2f1636e3be5e76d8987 Mon Sep 17 00:00:00 2001 From: Wu Libin Date: Wed, 28 Jan 2015 14:17:06 +0800 Subject: [PATCH] LU-6166 utils: fix bug in lr_link When create a hard link of a file, the path and the file name are same if it at the root directory, so the length of the path and name will be the same in this case. Signed-off-by: Wu Libin Change-Id: I3a72491efdc041ad0e96d036b04600b76bb646fe Reviewed-on: http://review.whamcloud.com/13546 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Yang Sheng Reviewed-by: Dmitry Eremin Reviewed-by: Oleg Drokin --- lustre/utils/lustre_rsync.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lustre/utils/lustre_rsync.c b/lustre/utils/lustre_rsync.c index 086dc21..5d28634 100644 --- a/lustre/utils/lustre_rsync.c +++ b/lustre/utils/lustre_rsync.c @@ -1005,7 +1005,7 @@ int lr_link(struct lr_info *info) break; len = strlen(info->path) - strlen(info->name); - if (len > 0 && strcmp(info->path + len, + if (len >= 0 && strcmp(info->path + len, info->name) == 0) snprintf(info->dest, PATH_MAX, "%s/%s", status->ls_targets[info->target_no], -- 1.8.3.1