Changeset 4556 in vbox for trunk/src/VBox
- Timestamp:
- Sep 6, 2007 12:24:45 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/posix/path-posix.cpp
r4071 r4556 410 410 int cchLink = readlink("/proc/self/exe", &g_szrtProgramPath[0], sizeof(g_szrtProgramPath) - 1); 411 411 # elif defined(RT_OS_SOLARIS) 412 pid_t curProcId = getpid();413 412 char szFileBuf[PATH_MAX + 1]; 414 sprintf(szFileBuf, "/proc/%ld/path/a.out", curProcId);413 sprintf(szFileBuf, "/proc/%ld/path/a.out", (long)getpid()); 415 414 int cchLink = readlink(szFileBuf, &g_szrtProgramPath[0], sizeof(g_szrtProgramPath) - 1); 416 415 # else /* RT_OS_FREEBSD: */ … … 481 480 482 481 #ifndef RT_OS_L4 483 /** 482 /** 484 483 * Worker for RTPathUserHome that looks up the home directory 485 * using the getpwuid_r api. 486 * 484 * using the getpwuid_r api. 485 * 487 486 * @returns IPRT status code. 488 487 * @param pszPath The path buffer. 489 488 * @param cchPath The size of the buffer. 490 489 * @param uid The User ID to query the home directory of. 491 */ 490 */ 492 491 static int rtPathUserHomeByPasswd(char *pszPath, size_t cchPath, uid_t uid) 493 492 { 494 /* 495 * The getpwuid_r function uses the passed in buffer to "allocate" any 496 * extra memory it needs. On some systems we should probably use the 493 /* 494 * The getpwuid_r function uses the passed in buffer to "allocate" any 495 * extra memory it needs. On some systems we should probably use the 497 496 * sysconf function to find the appropriate buffer size, but since it won't 498 * work everywhere we'll settle with a 5KB buffer and ASSUME that it'll 499 * suffice for even the lengthiest user descriptions... 497 * work everywhere we'll settle with a 5KB buffer and ASSUME that it'll 498 * suffice for even the lengthiest user descriptions... 500 499 */ 501 500 char achBuffer[5120]; … … 508 507 if (!pPasswd) /* uid not found in /etc/passwd */ 509 508 return VERR_PATH_NOT_FOUND; 510 509 511 510 /* 512 511 * Check that it isn't empty and that it exists. … … 538 537 539 538 540 /** 539 /** 541 540 * Worker for RTPathUserHome that looks up the home directory 542 * using the HOME environment variable. 543 * 541 * using the HOME environment variable. 542 * 544 543 * @returns IPRT status code. 545 544 * @param pszPath The path buffer. 546 545 * @param cchPath The size of the buffer. 547 */ 546 */ 548 547 static int rtPathUserHomeByEnv(char *pszPath, size_t cchPath) 549 548 { … … 554 553 const char *pszHome = getenv("HOME"); 555 554 if (!pszHome) 556 555 557 556 { 558 557 struct stat st; … … 596 595 else 597 596 rc = rtPathUserHomeByEnv(pszPath, cchPath); 598 599 /* 597 598 /* 600 599 * On failure, retry using the alternative method. 601 600 * (Should perhaps restrict the retry cases a bit more here...)
Note:
See TracChangeset
for help on using the changeset viewer.