Fix for working with symlinks in tar files
This commit is contained in:
parent
739d692e72
commit
79b8d61ae9
|
@ -1801,15 +1801,14 @@ bool cmSystemTools::CreateTar(const char* outFileName,
|
||||||
}
|
}
|
||||||
// Set the name of the entry to the file name
|
// Set the name of the entry to the file name
|
||||||
archive_entry_set_pathname(entry, rp.c_str());
|
archive_entry_set_pathname(entry, rp.c_str());
|
||||||
struct stat s;
|
archive_read_disk_entry_from_file(disk, entry, -1, 0);
|
||||||
stat(fileIt->c_str(), &s);
|
|
||||||
archive_read_disk_entry_from_file(disk, entry, -1, &s);
|
|
||||||
CHECK_ARCHIVE_ERROR(res, "read disk entry:");
|
CHECK_ARCHIVE_ERROR(res, "read disk entry:");
|
||||||
|
|
||||||
// write entry header
|
// write entry header
|
||||||
res = archive_write_header(a, entry);
|
res = archive_write_header(a, entry);
|
||||||
CHECK_ARCHIVE_ERROR(res, "write header: ");
|
CHECK_ARCHIVE_ERROR(res, "write header: ");
|
||||||
|
if(archive_entry_size(entry) > 0)
|
||||||
|
{
|
||||||
// now copy contents of file into archive a
|
// now copy contents of file into archive a
|
||||||
FILE* file = fopen(fileIt->c_str(), "rb");
|
FILE* file = fopen(fileIt->c_str(), "rb");
|
||||||
if(!file)
|
if(!file)
|
||||||
|
@ -1838,6 +1837,7 @@ bool cmSystemTools::CreateTar(const char* outFileName,
|
||||||
}
|
}
|
||||||
// close the file and free the entry
|
// close the file and free the entry
|
||||||
fclose(file);
|
fclose(file);
|
||||||
|
}
|
||||||
archive_entry_free(entry);
|
archive_entry_free(entry);
|
||||||
}
|
}
|
||||||
// close the archive and finish the write
|
// close the archive and finish the write
|
||||||
|
|
Loading…
Reference in New Issue