VirtualBox

Ignore:
Timestamp:
Jan 25, 2011 12:58:25 PM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
69642
Message:

VBoxExtPackHelperApp.cpp: Adjusted r69630 to restore the actual directory permissions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-helper-apps/VBoxExtPackHelperApp.cpp

    r35699 r35708  
    55
    66/*
    7  * Copyright (C) 2010 Oracle Corporation
     7 * Copyright (C) 2010-2011 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    347347static RTEXITCODE UnpackExtPackDir(const char *pszDstDirName, RTVFSOBJ hVfsObj)
    348348{
    349     int rc = RTDirCreate(pszDstDirName, 0755);
     349    /*
     350     * Get the mode mask before creating the directory.
     351     */
     352    RTFSOBJINFO ObjInfo;
     353    int rc = RTVfsObjQueryInfo(hVfsObj, &ObjInfo, RTFSOBJATTRADD_NOTHING);
     354    if (RT_FAILURE(rc))
     355        return RTMsgErrorExit(RTEXITCODE_FAILURE, "RTVfsObjQueryInfo failed on '%s': %Rrc", pszDstDirName, rc);
     356    ObjInfo.Attr.fMode &= ~(RTFS_UNIX_IWOTH | RTFS_UNIX_IWGRP);
     357
     358    rc = RTDirCreate(pszDstDirName, ObjInfo.Attr.fMode);
    350359    if (RT_FAILURE(rc))
    351360        return RTMsgErrorExit(RTEXITCODE_FAILURE, "Failed to create directory '%s': %Rrc", pszDstDirName, rc);
    352 #if !defined(RT_OS_WINDOWS)
    353     /* This is necessary because of umask! */
    354     rc = RTPathSetMode(pszDstDirName, 0755);
    355     if (RT_FAILURE(rc))
    356         return RTMsgErrorExit(RTEXITCODE_FAILURE, "Failed to set directory permissions: %Rrc ('%s')", rc, pszDstDirName);
     361
     362#ifndef RT_OS_WINDOWS
     363    /*
     364     * Because of umask, we have to apply the mode again.
     365     */
     366    rc = RTPathSetMode(pszDstDirName, ObjInfo.Attr.fMode);
     367    if (RT_FAILURE(rc))
     368        return RTMsgErrorExit(RTEXITCODE_FAILURE, "Failed to set directory permissions on '%s': %Rrc", pszDstDirName, rc);
    357369#else
    358370    /** @todo Ownership tricks on windows? */
Note: See TracChangeset for help on using the changeset viewer.

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