Project

General

Profile

Bug #2005 » rtld.excerpt.original.c

dragonflybsd1, 02/28/2011 09:00 PM

 
if (aux_info[AT_EXECPATH] != 0) {
char *kexecpath;
char buf[MAXPATHLEN];

kexecpath = aux_info[AT_EXECPATH]->a_un.a_ptr;
dbg("AT_EXECPATH %p %s", kexecpath, kexecpath);
if (kexecpath[0] == '/')
obj_main->path = kexecpath;
else if (getcwd(buf, sizeof(buf)) == NULL ||
strlcat(buf, "/", sizeof(buf)) >= sizeof(buf) ||
strlcat(buf, kexecpath, sizeof(buf)) >= sizeof(buf))
obj_main->path = xstrdup(argv0);
else
obj_main->path = xstrdup(buf);
} else {
dbg("No AT_EXECPATH");
obj_main->path = xstrdup(argv0);
}
dbg("obj_main path %s", obj_main->path);
obj_main->mainprog = true;

(2-2/2)