VirtualBox

Ignore:
Timestamp:
Jun 27, 2017 12:46:55 PM (7 years ago)
Author:
vboxsync
Message:

tarvfs.cpp: Relax rtZipTarReaderIsAtEnd a lot.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/zip/tarvfs.cpp

    r67149 r67635  
    817817static bool rtZipTarReaderIsAtEnd(PRTZIPTARREADER pThis)
    818818{
    819     /* Turns out our own tar writer code doesn't get this crap right.
    820        Kludge our way around it. */
    821     if (!pThis->cZeroHdrs)
    822         return pThis->enmPrevType == RTZIPTARTYPE_GNU ? true /* IPRT tar.cpp */ : false;
    823 
    824     /* Here is a kludge to try deal with archivers not putting at least two
    825        zero headers at the end.  Afraid it may require further relaxing
    826        later on, but let's try be strict about things for now. */
    827     return pThis->cZeroHdrs >= (pThis->enmPrevType == RTZIPTARTYPE_POSIX ? 2U : 1U);
     819    /*
     820     * In theory there shall always be two zero headers at the end of the
     821     * archive, but life isn't that simple.   We've been creating archives
     822     * without any zero headers at the end ourselves for a long long time
     823     * (old tar.cpp).
     824     *
     825     * So, we're fine if the state is 'FIRST' or 'ZERO' here, but we'll barf
     826     * if we're in the middle of a multi-header stream (long GNU names, sparse
     827     * files, PAX, etc).
     828     */
     829    return pThis->enmState == RTZIPTARREADERSTATE_FIRST
     830        || pThis->enmState == RTZIPTARREADERSTATE_ZERO;
    828831}
    829832
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette