Fix for working with symlinks in tar files

This commit is contained in:
Bill Hoffman 2009-11-08 19:59:01 -05:00
parent 739d692e72
commit 79b8d61ae9
1 changed files with 29 additions and 29 deletions

View File

@ -1801,15 +1801,14 @@ bool cmSystemTools::CreateTar(const char* outFileName,
}
// Set the name of the entry to the file name
archive_entry_set_pathname(entry, rp.c_str());
struct stat s;
stat(fileIt->c_str(), &s);
archive_read_disk_entry_from_file(disk, entry, -1, &s);
archive_read_disk_entry_from_file(disk, entry, -1, 0);
CHECK_ARCHIVE_ERROR(res, "read disk entry:");
// write entry header
res = archive_write_header(a, entry);
CHECK_ARCHIVE_ERROR(res, "write header: ");
if(archive_entry_size(entry) > 0)
{
// now copy contents of file into archive a
FILE* file = fopen(fileIt->c_str(), "rb");
if(!file)
@ -1838,6 +1837,7 @@ bool cmSystemTools::CreateTar(const char* outFileName,
}
// close the file and free the entry
fclose(file);
}
archive_entry_free(entry);
}
// close the archive and finish the write