Fixed a bug in match_hard_links() where an empty directory would try
authorWayne Davison <wayned@samba.org>
Mon, 21 Jul 2008 03:34:06 +0000 (20:34 -0700)
committerWayne Davison <wayned@samba.org>
Mon, 21 Jul 2008 03:34:06 +0000 (20:34 -0700)
to allocate 0 bytes of memory (which can fail on some OSes).

NEWS
hlink.c

diff --git a/NEWS b/NEWS
index 805a6ba0d66543777b3995c9cf10ad9621e6548f..bc1640efaa7e7ef1c9535417b4338b877e11dfb9 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,9 @@ Changes since 3.0.3:
 
   BUG FIXES:
 
+    - Fixed a bug in the hard-linking code where it would sometimes try to
+      allocate 0 bytes of memory (which fails on system OSes).
+
     - Changed the way --progress overwrites its prior output in order to make
       it nearly impossible for the progress to get overwritten by an error.
 
diff --git a/hlink.c b/hlink.c
index 0fe6bedafe48c784e377264064d5c6830f026f6b..ec4970966cc5e000bb0b511c87ec3f7a37207797 100644 (file)
--- a/hlink.c
+++ b/hlink.c
@@ -184,7 +184,7 @@ static void match_gnums(int32 *ndx_list, int ndx_count)
  * to first when we're done. */
 void match_hard_links(struct file_list *flist)
 {
-       if (!list_only) {
+       if (!list_only && flist->used) {
                int i, ndx_count = 0;
                int32 *ndx_list;