Remove Fseek() code from rpmcpioHeaderRead for now
authorFlorian Festi <ffesti@redhat.com>
Tue, 27 Mar 2012 09:09:45 +0000 (11:09 +0200)
committerFlorian Festi <ffesti@redhat.com>
Tue, 27 Mar 2012 12:12:42 +0000 (14:12 +0200)
Fseek() does not return a proper error code. This needs to be fixed before we can use it as most comprssed files do not support seeking and we need to be able to detect this reliably

lib/cpio.c

index 38321a1..3e670af 100644 (file)
@@ -252,20 +252,16 @@ int rpmcpioHeaderRead(rpmcpio_t cpio, char ** path, struct stat * st)
 
     /* Move to next file */
     if (cpio->fileend != cpio->offset) {
-        //if (Fseek(cpio->fd, cpio->fileend-cpio->offset, SEEK_CUR)) 
-        {
-            /* XXX try using Fseek() - which is currently broken */
-            char buf[8*BUFSIZ];
-            while (cpio->fileend != cpio->offset) {
-                read = cpio->fileend - cpio->offset > 8*BUFSIZ ? 8*BUFSIZ : cpio->fileend - cpio->offset;
-                if (rpmcpioRead(cpio, &buf, read) != read) {
-                    return CPIOERR_READ_FAILED;
-                }
+        /* XXX try using Fseek() - which is currently broken */
+        char buf[8*BUFSIZ];
+        while (cpio->fileend != cpio->offset) {
+            read = cpio->fileend - cpio->offset > 8*BUFSIZ ? 8*BUFSIZ : cpio->fileend - cpio->offset;
+            if (rpmcpioRead(cpio, &buf, read) != read) {
+                return CPIOERR_READ_FAILED;
             }
-            //} else { /* seek worked */
-            //cpio->offset = cpio->fileend;
         }
     }
+
     rc = rpmcpioReadPad(cpio);
     if (rc) return rc;