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.
This commit is contained in:
parent
3c2be9072d
commit
6e1b834928
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue