From 12a845ba9ee7051592f62e9c4f69735668907d10 Mon Sep 17 00:00:00 2001 From: "Clifford T. Matthews" Date: Sat, 5 Dec 2009 08:44:07 -0700 Subject: [PATCH] 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). --- src/main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main.c b/src/main.c index 3d58ef3..d76f41b 100644 --- a/src/main.c +++ b/src/main.c @@ -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;