[master 4/4] dd: drop unnecessary archive_read_data_skip

wgwoods installerbot-noreply at redhat.com
Wed Jun 24 16:25:48 UTC 2015


From: Will Woods <wwoods at redhat.com>

The libarchive docs on archive_read_data_skip say:

    Note that this function is invoked automatically by
    archive_read_next_header2() if the previous entry was not completely
    consumed.

..so there's no need for us to do it manually.
---
 utils/dd/rpmutils.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/utils/dd/rpmutils.c b/utils/dd/rpmutils.c
index 6d64917..9f06790 100644
--- a/utils/dd/rpmutils.c
+++ b/utils/dd/rpmutils.c
@@ -345,7 +345,6 @@ int explodeDDRPM(const char *source,
         const struct stat *fstat;
         int64_t fsize;
         const char* filename;
-        int needskip = 1; /* do we need to read the data to get to the next header? */
         int offset = 0;
         int towrite = 0;
 
@@ -400,11 +399,7 @@ int explodeDDRPM(const char *source,
             }
 
             rc = archive_read_data_into_fd(cpio, fileno(fdout));
-            if (rc!=ARCHIVE_OK) {
-                /* XXX We didn't get the file.. well.. */
-                needskip = 0;
-            } else {
-                needskip = 0;
+            if (rc==ARCHIVE_OK) {
                 /* set permissions on the new file */
                 chmod(filename+offset, fstat->st_mode);
             }
@@ -417,7 +412,6 @@ int explodeDDRPM(const char *source,
         while (towrite && S_ISLNK(fstat->st_mode)) {
             char symlinkbuffer[BUFFERSIZE-1];
 
-            needskip = 0;
             if ((rc = archive_read_data(cpio, symlinkbuffer, fsize))!=ARCHIVE_OK) {
                 /* XXX We didn't get the file.. well.. */
                 break;
@@ -430,8 +424,6 @@ int explodeDDRPM(const char *source,
             break;
         }
 
-        if(needskip)
-            archive_read_data_skip(cpio);
     }
 
     rc = archive_read_free(cpio); /* Also closes the RPM stream using callback */


-- 
To view this commit on github, visit https://github.com/rhinstaller/anaconda/commit/aa0ff768e1ad05957fb985fee298fe2829af3439


More information about the anaconda-patches mailing list