VirtualBox

Ticket #3270: virtualbox-ose-sudo-tmpdir.diff

File virtualbox-ose-sudo-tmpdir.diff, 1.4 KB (added by Martin Kudlvasr, 16 years ago)
  • src/libs/xpcom18a4/ipc/ipcd/shared/src/ipcConfig.cpp

     
    4444#include "prenv.h"
    4545#include "plstr.h"
    4646
     47#include <sys/types.h>
     48#include <pwd.h>
     49#include <unistd.h>
     50
    4751#if defined(XP_OS2) && !defined(XP_OS2_NATIVEIPC)
    4852#ifdef VBOX
    4953static const char kDefaultSocketPrefix[] = "\\socket\\vbox-";
     
    6064static const char kDefaultSocketSuffix[] = "-ipc/ipcd";
    6165#endif
    6266
     67const 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
    6377void IPC_GetDefaultSocketPath(char *buf, PRUint32 bufLen)
    6478{
    6579    const char *logName;
     
    7185
    7286    logName = PR_GetEnv("VBOX_IPC_SOCKETID");
    7387    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");
    7791            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                }
    8097            }
    8198        }
    8299    }

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy