Changeset 20316 in vbox
- Timestamp:
- Jun 5, 2009 12:15:59 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/SharedFolders/vbsf.cpp
r20292 r20316 607 607 * @retval pfOpen iprt create flags 608 608 */ 609 static int vbsfConvertFileOpenFlags(unsigned fShflFlags, RTFMODE fMode, unsigned *pfOpen)609 static int vbsfConvertFileOpenFlags(unsigned fShflFlags, RTFMODE fMode, SHFLHANDLE handleInitial, unsigned *pfOpen) 610 610 { 611 611 unsigned fOpen = 0; … … 626 626 if (!(fMode & RTFS_DOS_READONLY)) 627 627 fMode |= RTFS_UNIX_IWUSR | RTFS_UNIX_IWGRP | RTFS_UNIX_IWOTH; 628 } 629 630 /* Set the requested mode. */ 631 fOpen |= (fMode & RTFS_UNIX_MASK) << RTFILE_O_CREATE_MODE_SHIFT; 628 629 /* Set the requested mode using only allowed bits. */ 630 fOpen |= ((fMode & RTFS_UNIX_MASK) << RTFILE_O_CREATE_MODE_SHIFT) & RTFILE_O_CREATE_MODE_MASK; 631 } 632 else 633 { 634 /* Old linux and solaris additions did not initialize the Info.Attr.fMode field 635 * and it contained random bits from stack. Detect this using the handle field value 636 * passed from the guest: old additions set it (incorrectly) to 0, new additions 637 * set it to SHFL_HANDLE_NIL(~0). 638 */ 639 if (handleInitial == 0) 640 { 641 /* Old additions. Do nothing, use default mode. */ 642 } 643 else 644 { 645 /* New additions or Windows additions. Set the requested mode using only allowed bits. 646 * Note: Windows guest set RTFS_UNIX_MASK bits to 0, which means a default mode 647 * will be set in fOpen. 648 */ 649 fOpen |= ((fMode & RTFS_UNIX_MASK) << RTFILE_O_CREATE_MODE_SHIFT) & RTFILE_O_CREATE_MODE_MASK; 650 } 651 } 632 652 633 653 switch (BIT_FLAG(fShflFlags, SHFL_CF_ACCESS_MASK_RW)) … … 825 845 static int cErrors; 826 846 827 int rc = vbsfConvertFileOpenFlags(pParms->CreateFlags, pParms->Info.Attr.fMode, &fOpen);847 int rc = vbsfConvertFileOpenFlags(pParms->CreateFlags, pParms->Info.Attr.fMode, pParms->Handle, &fOpen); 828 848 if (RT_SUCCESS(rc)) 829 849 {
Note:
See TracChangeset
for help on using the changeset viewer.