Change alternate space base name from /emul/ibcs2 to /compat/ibcs2,

in line with linux alt space of /compat/linux.
This was pointed out by Stefan Esser.

In cheching alt space for libraries in imgact_coff.c, use const
ibcs2_emul_path instead of its own local string.  Also do a proper
malloc of temp name according to MAXPATHLEN.
This commit is contained in:
swallace 1995-10-10 17:33:19 +00:00
parent f775e5568b
commit 92a0f0536c
2 changed files with 25 additions and 17 deletions

View File

@ -43,7 +43,7 @@
#include <i386/ibcs2/ibcs2_util.h>
const char ibcs2_emul_path[] = "/emul/ibcs2";
const char ibcs2_emul_path[] = "/compat/ibcs2";
/*
* Search an alternate path before passing pathname arguments on

View File

@ -53,7 +53,6 @@ extern int exec_coff_imgact __P((struct image_params *iparams));
static int load_coff_section __P((struct vmspace *vmspace, struct vnode *vp, vm_offset_t offset, caddr_t vmaddr, size_t memsz, size_t filsz, vm_prot_t prot));
static int
load_coff_section(vmspace, vp, offset, vmaddr, memsz, filsz, prot)
struct vmspace *vmspace;
@ -380,23 +379,32 @@ exec_coff_imgact(iparams)
foff)) {
return ENOEXEC;
}
if(scns[i].s_size) {
char *libbuf;
int emul_path_len = strlen(ibcs2_emul_path);
libbuf = malloc(MAXPATHLEN + emul_path_len,
M_TEMP, M_WAITOK);
strcpy(libbuf, ibcs2_emul_path);
for (j = off; j < scns[i].s_size + off; j++) {
char *libname;
char libbuf[40];
libname = buf + j + 4 * *(long*)(buf + j + 4);
j += 4* *(long*)(buf + j);
DPRINTF(("%s(%d): shared library %s\n",
__FILE__, __LINE__, libname));
strcpy(libbuf, "/emul/ibcs2");
strcpy(&libbuf[11], libname);
strcpy(&libbuf[emul_path_len], libname);
error = coff_load_file(iparams->proc, libbuf);
if (error)
error = coff_load_file(iparams->proc, libname);
error = coff_load_file(iparams->proc,
libname);
if (error)
break;
}
free(libbuf, M_TEMP);
}
if (vm_map_remove(kernel_map,
(vm_offset_t) buf,
(vm_offset_t) buf + len))