Changeset 104954 in vbox
- Timestamp:
- Jun 18, 2024 11:14:14 AM (7 months ago)
- Location:
- trunk/src/VBox/Additions
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceAutoMount.cpp
r100331 r104954 389 389 if (RT_SUCCESS(rc)) 390 390 { 391 uint32_t cbOpts = RTSystemGetPageSize();392 char *pszOpts = (char *)alloca(cbOpts);393 RT_BZERO(pszOpts, cbOpts);394 395 391 # ifdef RT_OS_SOLARIS 396 392 int const fFlags = MS_OPTIONSTR; 397 RTStrPrintf(pszOpts, cbOpts, "uid=0,gid=%d,dmode=0770,fmode=0770,dmask=0000,fmask=0000", grp_vboxsf->gr_gid); 393 char szOptBuf[MAX_MNTOPT_STR] = { '\0', }; 394 RTStrPrintf(szOptBuf, sizeof(szOptBuf), "uid=0,gid=%d,dmode=0770,fmode=0770,dmask=0000,fmask=0000", grp_vboxsf->gr_gid); 398 395 int r = mount(pszShareName, 399 396 pszMountPoint, … … 402 399 NULL, /* char *dataptr */ 403 400 0, /* int datalen */ 404 pszOpts,405 cbOpts);401 szOptBuf, 402 sizeof(szOptBuf)); 406 403 if (r == 0) 407 404 VGSvcVerbose(0, "vbsvcAutoMountWorker: Shared folder '%s' was mounted to '%s'\n", pszShareName, pszMountPoint); … … 411 408 412 409 # else /* RT_OS_LINUX */ 410 uint32_t cbOpts = RTSystemGetPageSize(); 411 char *pszOpts = (char *)alloca(cbOpts); 412 RT_BZERO(pszOpts, cbOpts); 413 413 struct utsname uts; 414 414 AssertStmt(uname(&uts) != -1, strcpy(uts.release, "4.4.0")); … … 1469 1469 } 1470 1470 1471 # if defined(RT_OS_LINUX) 1472 /* 1473 * Linux a bit more work... 1474 */ 1475 struct utsname uts; 1476 AssertStmt(uname(&uts) != -1, strcpy(uts.release, "4.4.0")); 1471 1477 /* 1472 1478 * Allocate options string buffer which is limited to a page on most systems. … … 1474 1480 uint32_t cbOpts = RTSystemGetPageSize(); 1475 1481 char *pszOpts = (char *)alloca(cbOpts); 1476 1477 # if defined(RT_OS_LINUX)1478 /*1479 * Linux a bit more work...1480 */1481 struct utsname uts;1482 AssertStmt(uname(&uts) != -1, strcpy(uts.release, "4.4.0"));1483 1482 1484 1483 /* Built mount option string. Need st_name for pre 2.6.0 kernels. */ … … 1538 1537 * with EOVERFLOW in vfs_buildoptionstr() during domount() otherwise. 1539 1538 */ 1540 ssize_t cchOpts = RTStrPrintf2(pszOpts, cbOpts, 1539 char szOpts[MAX_MNTOPT_STR] = { '\0', }; 1540 ssize_t cchOpts = RTStrPrintf2(szOpts, sizeof(szOpts), 1541 1541 "uid=0,gid=%d,dmode=0770,fmode=0770,dmask=0000,fmask=0000,tag=%s", gidMount, g_szTag); 1542 1542 if (cchOpts <= 0) 1543 1543 { 1544 VGSvcError("vbsvcAutomounterMountIt: pszOpts overflow! %zd\n", cchOpts);1544 VGSvcError("vbsvcAutomounterMountIt: szOpts overflow! %zd\n", cchOpts); 1545 1545 return VERR_BUFFER_OVERFLOW; 1546 1546 } 1547 1547 1548 1548 rc = mount(pEntry->pszName, pEntry->pszActualMountPoint, MS_OPTIONSTR, "vboxfs", 1549 NULL /*dataptr*/, 0 /* datalen */, pszOpts, MAX_MNTOPT_STR);1549 NULL /*dataptr*/, 0 /* datalen */, szOpts, MAX_MNTOPT_STR); 1550 1550 if (rc == 0) 1551 1551 { … … 1556 1556 1557 1557 rc = errno; 1558 VGSvcError("vbsvcAutomounterMountIt: mount failed for '%s' on '%s' ( pszOpts=%s): %s (%d)\n",1559 pEntry->pszName, pEntry->pszActualMountPoint, pszOpts, strerror(rc), rc);1558 VGSvcError("vbsvcAutomounterMountIt: mount failed for '%s' on '%s' (szOpts=%s): %s (%d)\n", 1559 pEntry->pszName, pEntry->pszActualMountPoint, szOpts, strerror(rc), rc); 1560 1560 return VERR_OPEN_FAILED; 1561 1561 -
trunk/src/VBox/Additions/solaris/SharedFolders/vboxfs_mount.c
r100317 r104954 47 47 #include <sys/mount.h> 48 48 49 #include <iprt/param.h> /* For PAGE_SIZE */50 51 49 #include "vboxfs.h" 52 50 … … 55 53 * Global Variables * 56 54 *********************************************************************************************************************************/ 57 static char g_achOptBuf[ PAGE_SIZE] = { '\0', };55 static char g_achOptBuf[MAX_MNTOPT_STR] = { '\0', }; 58 56 static const int g_RetErr = 33; 59 57 static const int g_RetMagic = 2;
Note:
See TracChangeset
for help on using the changeset viewer.