Whamcloud - gitweb
LU-6166 utils: fix bug in lr_link 46/13546/2
authorWu Libin <lwu@ddn.com>
Wed, 28 Jan 2015 06:17:06 +0000 (14:17 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Sun, 8 Feb 2015 02:43:34 +0000 (02:43 +0000)
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 <lwu@ddn.com>
Change-Id: I3a72491efdc041ad0e96d036b04600b76bb646fe
Reviewed-on: http://review.whamcloud.com/13546
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Yang Sheng <yang.sheng@intel.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/utils/lustre_rsync.c

index 086dc21..5d28634 100644 (file)
@@ -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],