#include <sys/mman.h>
#endif
+/* For PATH_EXEC */
+#include <sxe-paths.h>
+
#ifndef SEPCHAR
#define SEPCHAR ':'
#endif
if (me >= 65536) {
stderr_out("Backtrace overflow, loop ?\n");
abort();
+ } else {
+ backtrace[me].obj = 0;
+ backtrace[me].position = 0;
+ backtrace[me].offset = 0;
+
+ pdump_add_entry(pdump_get_entry_list(sdesc),
+ data, sdesc->size, count);
+ for (i = 0; i < count; i++) {
+ pdump_register_sub(
+ ((const char*)data) + sdesc->size * i,
+ sdesc->description, me);
+ }
+ --depth;
}
- backtrace[me].obj = 0;
- backtrace[me].position = 0;
- backtrace[me].offset = 0;
-
- pdump_add_entry(pdump_get_entry_list(sdesc),
- data, sdesc->size, count);
- for (i = 0; i < count; i++) {
- pdump_register_sub(
- ((const char*)data) + sdesc->size * i,
- sdesc->description, me);
- }
- --depth;
}
}
int pdump_load(const char *argv0)
{
char exe_path[PATH_MAX], real_exe_path[PATH_MAX];
+ char libarchdir_path[PATH_MAX] = PATH_EXEC "/sxemacs";
char *w;
const char *dir, *p;
/* invocation-name includes a directory component -- presumably it
is relative to cwd, not $PATH */
assert(strlen(dir) < sizeof(exe_path));
- strncpy(exe_path, dir, sizeof(exe_path)-1);
+ xstrncpy(exe_path, dir, sizeof(exe_path));
exe_path[sizeof(exe_path)-1]='\0';
} else {
const char *path = getenv("PATH");
remain--;
}
if (remain > 0) {
- strncpy(w, name, remain);
+ xstrncpy(w, name, remain);
w[remain]='\0';
}
/* Save exe_path because pdump_file_try() modifies it */
assert(strlen(exe_path) < sizeof(real_exe_path));
- strcpy(real_exe_path, exe_path);
+ xstrncpy(real_exe_path, exe_path, sizeof(real_exe_path));
if (pdump_file_try(exe_path,sizeof(exe_path))
|| (xrealpath(real_exe_path, real_exe_path)
- && pdump_file_try(real_exe_path,sizeof(real_exe_path)))) {
+ && pdump_file_try(real_exe_path,sizeof(real_exe_path)))
+ || pdump_file_try(libarchdir_path,sizeof(libarchdir_path)) ) {
pdump_load_finish();
return 1;
}