Fixed bug that was causing Executor to crash on systems where argv[0] isn't guaranteed to have a slash in it (e.g., Fedora 12).

This commit is contained in:
Clifford T. Matthews 2009-12-05 08:44:07 -07:00
parent 44c8a96e32
commit 12a845ba9e

View File

@ -722,10 +722,12 @@ A1(PRIVATE, void, setstartdir, char *, argv0)
misc_self_examination (lookhere);
#endif
suffix = rindex(lookhere, '/');
*suffix = 0;
if (suffix)
*suffix = 0;
getcwd(savedir, sizeof savedir);
Uchdir(lookhere);
*suffix = '/';
if (suffix)
*suffix = '/';
getcwd(ROMlib_startdir, sizeof ROMlib_startdir);
Uchdir(savedir);
ROMlib_startdirlen = strlen(ROMlib_startdir) + 1;