Ticket #3270: virtualbox-ose-sudo-tmpdir.diff
| File virtualbox-ose-sudo-tmpdir.diff, 1.4 KB (added by , 16 years ago) |
|---|
-
src/libs/xpcom18a4/ipc/ipcd/shared/src/ipcConfig.cpp
44 44 #include "prenv.h" 45 45 #include "plstr.h" 46 46 47 #include <sys/types.h> 48 #include <pwd.h> 49 #include <unistd.h> 50 47 51 #if defined(XP_OS2) && !defined(XP_OS2_NATIVEIPC) 48 52 #ifdef VBOX 49 53 static const char kDefaultSocketPrefix[] = "\\socket\\vbox-"; … … 60 64 static const char kDefaultSocketSuffix[] = "-ipc/ipcd"; 61 65 #endif 62 66 67 const char * IPC_GetUsername(void) 68 { 69 struct passwd * pw_struct; 70 pw_struct = getpwuid(getuid()); 71 if (!pw_struct) { 72 return NULL; 73 } 74 return pw_struct->pw_name; 75 } 76 63 77 void IPC_GetDefaultSocketPath(char *buf, PRUint32 bufLen) 64 78 { 65 79 const char *logName; … … 71 85 72 86 logName = PR_GetEnv("VBOX_IPC_SOCKETID"); 73 87 if (!logName || !logName[0]) { 74 logName = PR_GetEnv("LOGNAME");75 if (!logName || !logName[0]) {76 logName = PR_GetEnv(" USER");88 logName = IPC_GetUsername(); 89 if (!logName) { 90 logName = PR_GetEnv("LOGNAME"); 77 91 if (!logName || !logName[0]) { 78 LOG(("could not determine username from environment\n")); 79 goto end; 92 logName = PR_GetEnv("USER"); 93 if (!logName || !logName[0]) { 94 LOG(("could not determine username from environment\n")); 95 goto end; 96 } 80 97 } 81 98 } 82 99 }

