VirtualBox

Changeset 51712 in vbox for trunk/src


Ignore:
Timestamp:
Jun 24, 2014 2:42:55 PM (11 years ago)
Author:
vboxsync
Message:

Runtime/pkzipvfs: more sensible default file attributes; don't need to seek the stream to retrieve the size, use RTVfsIoStrmQueryInfo() instead

File:
1 edited

Legend:

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

    r51701 r51712  
    545545    const char *pszEnd = strchr(pThis->szName, '\0');
    546546    if (pszEnd == &pThis->szName[0] || pszEnd[-1] != '/')
    547         pObjInfo->Attr.fMode = RTFS_TYPE_FILE | RTFS_UNIX_IRUSR | RTFS_UNIX_IRWXU;
     547        pObjInfo->Attr.fMode = RTFS_TYPE_FILE \
     548                             | RTFS_UNIX_IRUSR | RTFS_UNIX_IWUSR \
     549                             | RTFS_UNIX_IRGRP \
     550                             | RTFS_UNIX_IROTH;
    548551    else
    549         pObjInfo->Attr.fMode = RTFS_TYPE_DIRECTORY | RTFS_UNIX_IRUSR | RTFS_UNIX_IRUSR | RTFS_UNIX_IXUSR;
     552        pObjInfo->Attr.fMode = RTFS_TYPE_DIRECTORY \
     553                             | RTFS_UNIX_IRWXU \
     554                             | RTFS_UNIX_IRGRP | RTFS_UNIX_IXGRP \
     555                             | RTFS_UNIX_IROTH | RTFS_UNIX_IXOTH;
    550556    pObjInfo->Attr.enmAdditional = RTFSOBJATTRADD_UNIX;
    551557    pObjInfo->Attr.u.Unix.cHardlinks = 1;
     
    672678static int rtZipPkzipFssIosReadEocb(PRTZIPPKZIPFSSTREAM pThis)
    673679{
    674     uint64_t cbFile;
    675     int rc = RTVfsFileSeek(RTVfsIoStrmToFile(pThis->hVfsIos), 0, RTFILE_SEEK_END, &cbFile);
     680    RTFSOBJINFO Info;
     681    int rc = RTVfsIoStrmQueryInfo(pThis->hVfsIos, &Info, RTFSOBJATTRADD_UNIX);
    676682    if (RT_FAILURE(rc))
    677683        return rc;
    678684
     685    uint64_t cbFile = Info.cbObject;
    679686    if (cbFile < sizeof(RTZIPPKZIPENDOFCENTRDIRREC)-1)
    680687        return VERR_PKZIP_NO_EOCB;
     
    11821189            return pThis->rcFatal = VERR_PKZIP_UNKNOWN_TYPE_FLAG;
    11831190    }
     1191    pThis->hVfsCurObj = hVfsObj;
    11841192
    11851193    if (ppszName)
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