浏览代码

Do not add the content of a file if it's a symlink.

This wasn't necessary for TAR-like (TGZ, TBZ2, etc...) archive
because for those the size was 0. Either there is an error in
upstream libarchive concerning the size or we should not rely
on size of the entry for adding content.
Eric NOULARD 14 年之前
父节点
当前提交
768cf91831
共有 1 个文件被更改,包括 7 次插入3 次删除
  1. 7 3
      Source/cmArchiveWrite.cxx

+ 7 - 3
Source/cmArchiveWrite.cxx

@@ -247,10 +247,14 @@ bool cmArchiveWrite::AddFile(const char* file,
     return false;
     return false;
     }
     }
 
 
-  // Content.
-  if(size_t size = static_cast<size_t>(archive_entry_size(e)))
+  // do not copy content of symlink
+  if (!archive_entry_symlink(e))
     {
     {
-    return this->AddData(file, size);
+    // Content.
+    if(size_t size = static_cast<size_t>(archive_entry_size(e)))
+      {
+      return this->AddData(file, size);
+      }
     }
     }
   return true;
   return true;
 }
 }