[Cmake-commits] CMake branch, master, updated. v3.11.2-817-g90e7103

Kitware Robot kwrobot at kitware.com
Mon May 21 11:15:03 EDT 2018


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, master has been updated
       via  90e7103fc6bc83abd6d712b43952ebba22e2f5a8 (commit)
       via  a203fcc63d3e11a44c51f818710bb304c1b6f780 (commit)
      from  5915c5bf554e2671af81421ab02aee9d0fe89e9a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=90e7103fc6bc83abd6d712b43952ebba22e2f5a8
commit 90e7103fc6bc83abd6d712b43952ebba22e2f5a8
Merge: 5915c5b a203fcc
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon May 21 15:04:56 2018 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Mon May 21 11:05:42 2018 -0400

    Merge topic 'pr.copy_data_check'
    
    a203fcc63d cmake: Teach '-E tar' to report errors copying data
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !2075


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a203fcc63d3e11a44c51f818710bb304c1b6f780
commit a203fcc63d3e11a44c51f818710bb304c1b6f780
Author:     Ruslan Baratov <ruslan_baratov at yahoo.com>
AuthorDate: Wed May 16 23:44:56 2018 +0300
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Fri May 18 10:04:18 2018 -0400

    cmake: Teach '-E tar' to report errors copying data
    
    The `copy_data` function checks for errors but the caller ignored
    them.  Simplify its return type and add a check to the caller.

diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 94c5ee8..169b525 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -1696,7 +1696,8 @@ void list_item_verbose(FILE* out, struct archive_entry* entry)
   fflush(out);
 }
 
-long copy_data(struct archive* ar, struct archive* aw)
+// Return 'true' on success
+bool copy_data(struct archive* ar, struct archive* aw)
 {
   long r;
   const void* buff;
@@ -1708,22 +1709,28 @@ long copy_data(struct archive* ar, struct archive* aw)
 #endif
 
   for (;;) {
+    // Return value:
+    // * ARCHIVE_OK - read succeed
+    // * ARCHIVE_EOF - no more data to read left
     r = archive_read_data_block(ar, &buff, &size, &offset);
     if (r == ARCHIVE_EOF) {
-      return (ARCHIVE_OK);
+      return true;
     }
     if (r != ARCHIVE_OK) {
-      return (r);
+      return false;
     }
-    r = archive_write_data_block(aw, buff, size, offset);
-    if (r != ARCHIVE_OK) {
+    // Return value:
+    // * >= ARCHIVE_OK - write succeed
+    // * < ARCHIVE_OK - write failed
+    const la_ssize_t w_size = archive_write_data_block(aw, buff, size, offset);
+    if (w_size < ARCHIVE_OK) {
       cmSystemTools::Message("archive_write_data_block()",
                              archive_error_string(aw));
-      return (r);
+      return false;
     }
   }
 #if !defined(__clang__) && !defined(__HP_aCC)
-  return r; /* this should not happen but it quiets some compilers */
+  return false; /* this should not happen but it quiets some compilers */
 #endif
 }
 
@@ -1776,7 +1783,10 @@ bool extract_tar(const char* outFileName, bool verbose, bool extract)
 
       r = archive_write_header(ext, entry);
       if (r == ARCHIVE_OK) {
-        copy_data(a, ext);
+        if (!copy_data(a, ext)) {
+          cmSystemTools::Error("Problem with copy_data");
+          break;
+        }
         r = archive_write_finish_entry(ext);
         if (r != ARCHIVE_OK) {
           cmSystemTools::Error("Problem with archive_write_finish_entry(): ",

-----------------------------------------------------------------------

Summary of changes:
 Source/cmSystemTools.cxx |   26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list