|
From: Sam S. <sd...@gn...> - 2011-07-13 19:17:11
|
> * Anton Vodonosov <nib...@ln...> [2011-07-13 20:42:47 +0400]:
>
> $ ./lisp.exe -q -norc -M lispinit.mem -x '(sys::program-name)'
> "lisp.exe"
OK, this is a bug and the cause of all the rest of your woes.
could you please run the above in gdb, set a breakpoint in find_executable()
and see why it does not put the full patch into executable_name.
Apparently, GetModuleFileName puts "lisp.exe" into execname (execname.c:67).
Is that the case?
does this patch fix the problem?
======================================================
diff -r 34301ca4e079 src/execname.c
--- a/src/execname.c Wed Jul 13 11:03:32 2011 -0400
+++ b/src/execname.c Wed Jul 13 15:12:51 2011 -0400
@@ -63,11 +63,15 @@ int find_executable (const char * progra
if (executable_name != NULL) return 0;
#if defined(WIN32_NATIVE)
{ /* an illustration that win32 API can be sometimes useful */
- char execname[MAX_PATH];
+ char execname[MAX_PATH], fullname[MAX_PATH];
+ DWORD len;
if (!GetModuleFileName(NULL,execname,MAX_PATH))
goto notfound;
- executable_name = (char*)malloc(strlen(execname)+1);
- strcpy(executable_name,execname);
+ len = GetFullPathName(execname,MAX_PATH,fullname,NULL);
+ if (len <= 0)
+ goto notfound;
+ executable_name = (char*)malloc(len+1);
+ strcpy(executable_name,fullname);
return 0; }
#elif defined(UNIX)
#if defined(UNIX_LINUX) || defined(UNIX_CYGWIN32)
======================================================
--
Sam Steingold (http://sds.podval.org/) on CentOS release 5.6 (Final) X 11.0.60900031
http://www.PetitionOnline.com/tap12009/ http://pmw.org.il
http://ffii.org http://jihadwatch.org http://www.memritv.org
Daddy, why doesn't this magnet pick up this floppy disk?
|