From: Wu Libin Date: Wed, 28 Jan 2015 06:17:06 +0000 (+0800) Subject: LU-6166 utils: fix bug in lr_link X-Git-Tag: 2.6.94~6 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=20520e9a2667f63a2630b2f1636e3be5e76d8987 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 --- 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],