diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2012-04-18 11:38:29 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2012-04-18 11:38:29 +0300 |
commit | 6e1b83492808cf636ec76c17a4646b3dc2d4b8a7 (patch) | |
tree | 4997cf2eff9d297e6a790f993d30f3cc272e9ccb | |
parent | 3c2be9072df9c41159d57e0021faaff62d5dfcb4 (diff) | |
download | rpm-6e1b83492808cf636ec76c17a4646b3dc2d4b8a7.tar.gz rpm-6e1b83492808cf636ec76c17a4646b3dc2d4b8a7.tar.bz2 rpm-6e1b83492808cf636ec76c17a4646b3dc2d4b8a7.zip |
Move cpio end trailer detection to the cpio code
- The fsm shouldn't know any archive format specifics, detect the trailer
from rpmcpioHeaderRead() and signal EOF through CPIOERR_HDR_TRAILER
instead.
-rw-r--r-- | lib/cpio.c | 4 | ||||
-rw-r--r-- | lib/fsm.c | 4 |
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/cpio.c b/lib/cpio.c index 045b56e46..c7a8bdf99 100644 --- a/lib/cpio.c +++ b/lib/cpio.c @@ -21,6 +21,7 @@ #include <rpm/rpmio.h> #include <rpm/rpmlog.h> +#include <rpm/rpmstring.h> #include "lib/cpio.h" @@ -303,6 +304,9 @@ int rpmcpioHeaderRead(rpmcpio_t cpio, char ** path, struct stat * st) rc = rpmcpioReadPad(cpio); cpio->fileend = cpio->offset + st->st_size; + if (!rc && rstreq(*path, CPIO_TRAILER)) + rc = CPIOERR_HDR_TRAILER; + return rc; } @@ -1723,8 +1723,10 @@ int rpmPackageFilesInstall(rpmts ts, rpmte te, rpmfi fi, FD_t cfd, rc = rpmcpioHeaderRead(archive, &(fsm->path), &(fsm->sb)); /* Detect and exit on end-of-payload. */ - if (!rc && rstreq(fsm->path, CPIO_TRAILER)) + if (rc == CPIOERR_HDR_TRAILER) { + rc = 0; break; + } if (rc) break; |