From 5668a5f30b8fbc1b006b74162ab6e6d8e41ae048 Mon Sep 17 00:00:00 2001 From: swallace Date: Tue, 10 Oct 1995 17:33:19 +0000 Subject: 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. --- sys/i386/ibcs2/ibcs2_util.c | 2 +- sys/i386/ibcs2/imgact_coff.c | 44 ++++++++++++++++++++++++++------------------ 2 files changed, 27 insertions(+), 19 deletions(-) (limited to 'sys/i386/ibcs2') diff --git a/sys/i386/ibcs2/ibcs2_util.c b/sys/i386/ibcs2/ibcs2_util.c index ce1e0e4..3f7cb2a 100644 --- a/sys/i386/ibcs2/ibcs2_util.c +++ b/sys/i386/ibcs2/ibcs2_util.c @@ -43,7 +43,7 @@ #include -const char ibcs2_emul_path[] = "/emul/ibcs2"; +const char ibcs2_emul_path[] = "/compat/ibcs2"; /* * Search an alternate path before passing pathname arguments on diff --git a/sys/i386/ibcs2/imgact_coff.c b/sys/i386/ibcs2/imgact_coff.c index 2318f7d..31c8ecf 100644 --- a/sys/i386/ibcs2/imgact_coff.c +++ b/sys/i386/ibcs2/imgact_coff.c @@ -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; } - 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); - error = coff_load_file(iparams->proc, libbuf); - if (error) - error = coff_load_file(iparams->proc, libname); - if (error) - break; - } + 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; + + 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_path_len], libname); + error = coff_load_file(iparams->proc, libbuf); + if (error) + 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)) -- cgit v1.1