VirtualBox

Changeset 58580 in vbox


Ignore:
Timestamp:
Nov 5, 2015 2:18:59 PM (9 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
103938
Message:

bugref:8087: Additions/x11: support non-root X server: do not fork and exec in a shared library constructor, as this plays very badly with LD_PRELOAD.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/GuestHost/OpenGL/util/process.c

    r53726 r58580  
    1515#ifndef WINDOWS
    1616#include <unistd.h>
     17# ifdef VBOX
     18#  include <string.h>
     19# endif
    1720#else
    1821#pragma warning ( disable : 4127 )
     
    130133        }
    131134#else
     135#ifdef VBOX
     136    const char *pszExecName, *pszProgName;
     137#  ifdef SunOS
     138    pszExecName = getexecname();
     139#  else
     140    extern const char *__progname;
     141    pszExecName = __progname;
     142#  endif
     143    if (!pszExecName)
     144        pszExecName = "<unknown>";
     145    pszProgName = strrchr(pszExecName, '/');
     146    if (pszProgName && *(pszProgName + 1))
     147        pszProgName++;
     148    else
     149        pszProgName = pszExecName;
     150    strncpy(name, pszProgName, maxLen);
     151    name[maxLen - 1] = '\0';
     152# else
    132153        /* Unix:
    133154         * Call getpid() to get our process ID.
     
    149170        /* pipe output of ps to temp file */
    150171#ifndef SunOS
    151 # ifdef VBOX
    152         snprintf(command, sizeof(command), "ps > %s", tmp);
    153 # else
    154172        sprintf(command, "ps > %s", tmp);
    155 # endif
    156 #else
    157 # ifdef VBOX
    158         snprintf(command, sizeof(command), "ps -e -o 'pid tty time comm'> %s", tmp);
    159 # else
     173#else
    160174        sprintf(command, "ps -e -o 'pid tty time comm'> %s", tmp);
    161 # endif
    162175#endif
    163176        system(command);
     
    188201        }
    189202        remove(tmp);
     203# endif
    190204#endif
    191205}
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette