[Cmake-commits] [cmake-commits] hoffman committed cmSystemTools.cxx 1.416 1.417
cmake-commits at cmake.org
cmake-commits at cmake.org
Sun Nov 8 19:59:04 EST 2009
Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv1546
Modified Files:
cmSystemTools.cxx
Log Message:
Fix for working with symlinks in tar files
Index: cmSystemTools.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmSystemTools.cxx,v
retrieving revision 1.416
retrieving revision 1.417
diff -C 2 -d -r1.416 -r1.417
*** cmSystemTools.cxx 8 Nov 2009 15:34:12 -0000 1.416
--- cmSystemTools.cxx 9 Nov 2009 00:59:01 -0000 1.417
***************
*** 1802,1808 ****
// 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);
CHECK_ARCHIVE_ERROR(res, "read disk entry:");
--- 1802,1806 ----
// Set the name of the entry to the file name
archive_entry_set_pathname(entry, rp.c_str());
! archive_read_disk_entry_from_file(disk, entry, -1, 0);
CHECK_ARCHIVE_ERROR(res, "read disk entry:");
***************
*** 1810,1842 ****
res = archive_write_header(a, entry);
CHECK_ARCHIVE_ERROR(res, "write header: ");
!
! // now copy contents of file into archive a
! FILE* file = fopen(fileIt->c_str(), "rb");
! if(!file)
! {
! cmSystemTools::Error("Problem with fopen(): ",
! fileIt->c_str());
! return false;
! }
! char buff[16384];
! size_t len = fread(buff, 1, sizeof(buff), file);
! while (len > 0)
{
! size_t wlen = archive_write_data(a, buff, len);
! if(wlen != len)
! {
! cmOStringStream error;
! error << "Problem with archive_write_data\n"
! << "Tried to write [" << len << "] bytes.\n"
! << "archive_write_data wrote [" << wlen << "] bytes.\n";
! cmSystemTools::Error(error.str().c_str(),
! archive_error_string(a)
! );
! return false;
}
! len = fread(buff, 1, sizeof(buff), file);
}
- // close the file and free the entry
- fclose(file);
archive_entry_free(entry);
}
--- 1808,1842 ----
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)
! {
! cmSystemTools::Error("Problem with fopen(): ",
! fileIt->c_str());
! return false;
}
! char buff[16384];
! size_t len = fread(buff, 1, sizeof(buff), file);
! while (len > 0)
! {
! size_t wlen = archive_write_data(a, buff, len);
! if(wlen != len)
! {
! cmOStringStream error;
! error << "Problem with archive_write_data\n"
! << "Tried to write [" << len << "] bytes.\n"
! << "archive_write_data wrote [" << wlen << "] bytes.\n";
! cmSystemTools::Error(error.str().c_str(),
! archive_error_string(a)
! );
! return false;
! }
! len = fread(buff, 1, sizeof(buff), file);
! }
! // close the file and free the entry
! fclose(file);
}
archive_entry_free(entry);
}
More information about the Cmake-commits
mailing list