pike.git / src / main.c

version» Context lines:

pike.git/src/main.c:89:   #define MAXPATHLEN 32768   #endif      static const char _master_location[MAXPATHLEN+CONSTANT_STRLEN(MASTER_COOKIE)] = MASTER_COOKIE;   static const char *master_file_location = _master_location + CONSTANT_STRLEN(MASTER_COOKIE);      static void set_master(const char *file)   {    if( master_file_location != _master_location+CONSTANT_STRLEN(MASTER_COOKIE))    free((void*)master_file_location); + #if DEBUG_MALLOC + #ifndef __NT__   #undef strdup /* We can't use dmalloc strdup before pike_memory is initialized. */ -  + #else + #define strdup _strdup + #endif /* __NT__ */ + #endif /* DEBUG_MALLOC */    master_file_location = strdup( file );   }      #ifdef __NT__   static void get_master_key(HKEY cat)   {    HKEY k; -  char buffer[4096]; +  char * buffer = malloc(4096);    DWORD len=sizeof(buffer)-1,type=REG_SZ;       if(RegOpenKeyEx(cat,    (LPCTSTR)("SOFTWARE\\Pike\\"    DEFINETOSTR(PIKE_MAJOR_VERSION)    "."    DEFINETOSTR(PIKE_MINOR_VERSION)    "."    DEFINETOSTR(PIKE_BUILD_VERSION)),    0,KEY_READ,&k)==ERROR_SUCCESS)
pike.git/src/main.c:154:    set_master( tmp );    }      #ifdef __NT__    if (!(*mp == '/' || *mp == '\\' || (isalpha (*mp) && mp[1] == ':'))) {    char exepath[MAXPATHLEN];    if (!GetModuleFileName (NULL, exepath, _MAX_PATH))    fprintf (stderr, "Failed to get path to exe file: %d\n",    GetLastError());    else { -  char tmp[MAXPATHLEN * 2]; +  char * tmp = malloc(MAXPATHLEN * 2);    char *p = strrchr (exepath, '\\');    if (p) *p = 0;    snprintf (tmp, sizeof (tmp), "%s/%s", exepath, mp);    set_master( tmp );    }    }   #else    if (!*mp) {    /* Attempt to find a master via the path to the binary. */    /* Note: We assume that MAXPATHLEN is > 18 characters. */
pike.git/src/main.c:286: Inside #if defined(LIBPIKE)
   memcpy(dir, "pike.so", CONSTANT_STRLEN("pike.so") + 1);    }   #endif /* LIBPIKE */   }      int main(int argc, char **argv)   {    JMP_BUF back;    int e, num;    char *p; -  +    #ifdef PIKE_EXTRA_DEBUG    if (sizeof(void *) == 8) {    /* 64-bit Solaris 10 in Xenofarm fails with SIGPIPE.    * Force a core dump.    */    signal(SIGPIPE, abort);    }   #endif      #ifdef HAVE_MALLOPT