Changeset 102340 in vbox for trunk/src/libs/xpcom18a4/ipc
- Timestamp:
- Nov 27, 2023 5:50:21 PM (14 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/libs/xpcom18a4/ipc/ipcd/shared/src/ipcConfig.cpp
r102249 r102340 37 37 #define LOG_GROUP LOG_GROUP_IPC 38 38 39 #if defined(XP_WIN)40 #elif defined(XP_OS2) && defined(XP_OS2_NATIVEIPC)41 #else42 #include <string.h>43 #ifdef XP_UNIX44 39 #include <unistd.h> 45 40 #include <sys/types.h> 46 41 #include <pwd.h> 47 #endif 42 48 43 #include "ipcConfig.h" 49 #include "plstr.h"50 44 51 45 #include <iprt/env.h> 46 #include <iprt/string.h> 52 47 #include <VBox/log.h> 53 48 54 #if defined(XP_OS2) && !defined(XP_OS2_NATIVEIPC)55 #ifdef VBOX56 static const char kDefaultSocketPrefix[] = "\\socket\\vbox-";57 #else58 static const char kDefaultSocketPrefix[] = "\\socket\\mozilla-";59 #endif60 static const char kDefaultSocketSuffix[] = "-ipc\\ipcd";61 #else62 #ifdef VBOX63 49 static const char kDefaultSocketPrefix[] = "/tmp/.vbox-"; 64 #else65 static const char kDefaultSocketPrefix[] = "/tmp/.mozilla-";66 #endif67 50 static const char kDefaultSocketSuffix[] = "-ipc/ipcd"; 68 #endif69 51 70 52 void IPC_GetDefaultSocketPath(char *buf, PRUint32 bufLen) … … 73 55 int len; 74 56 75 PL_strncpyz(buf, kDefaultSocketPrefix, bufLen); 76 buf += (sizeof(kDefaultSocketPrefix) - 1); 77 bufLen -= (sizeof(kDefaultSocketPrefix) - 1); 57 char *pszDst = buf; 58 size_t cbDst = bufLen; 59 int vrc = RTStrCopyP(&pszDst, &cbDst, kDefaultSocketPrefix); 60 AssertRC(vrc); RT_NOREF(vrc); 78 61 79 62 logName = RTEnvGet("VBOX_IPC_SOCKETID"); 80 #if defined(VBOX) && defined(XP_UNIX)81 63 if (!logName || !logName[0]) { 82 64 struct passwd *passStruct = getpwuid(getuid()); … … 84 66 logName = passStruct->pw_name; 85 67 } 86 #endif 68 87 69 if (!logName || !logName[0]) { 88 70 logName = RTEnvGet("LOGNAME"); … … 95 77 } 96 78 } 97 PL_strncpyz(buf, logName, bufLen); 98 len = strlen(logName); 99 buf += len; 100 bufLen -= len; 79 80 vrc = RTStrCopyP(&pszDst, &cbDst, logName); 81 AssertRC(vrc); RT_NOREF(vrc); 101 82 102 83 end: 103 PL_strncpyz(buf, kDefaultSocketSuffix, bufLen); 84 vrc = RTStrCopyP(&pszDst, &cbDst, kDefaultSocketSuffix); 85 AssertRC(vrc); RT_NOREF(vrc); 104 86 } 105 106 #endif
Note:
See TracChangeset
for help on using the changeset viewer.