Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern make a copy of the epp->ep_path, because it is too ...



details:   https://anonhg.NetBSD.org/src/rev/1eeacbc1b1a1
branches:  trunk
changeset: 516705:1eeacbc1b1a1
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Oct 28 04:46:42 2001 +0000

description:
make a copy of the epp->ep_path, because it is too late to use it when
copyargs is called since we've swapped vmspaces.

diffstat:

 sys/kern/exec_macho.c |  16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diffs (44 lines):

diff -r 477fce046a8f -r 1eeacbc1b1a1 sys/kern/exec_macho.c
--- a/sys/kern/exec_macho.c     Sun Oct 28 02:03:00 2001 +0000
+++ b/sys/kern/exec_macho.c     Sun Oct 28 04:46:42 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: exec_macho.c,v 1.2 2001/07/14 03:05:31 christos Exp $  */
+/*     $NetBSD: exec_macho.c,v 1.3 2001/10/28 04:46:42 christos Exp $  */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -226,7 +226,7 @@
 static int
 exec_macho_load_dylib(struct proc *p, struct exec_package *epp,
     struct exec_macho_dylib_command *dy) {
-#ifdef notyet
+#ifdef notdef
        const char *name = ((const char *)dy) + dy->dylib.name.offset;
        char path[MAXPATHLEN];
        int error;
@@ -235,7 +235,7 @@
 #ifdef DEBUG_MACHO
        exec_macho_print_dylib_command(dy);
 #endif
-#ifdef notyet
+#ifdef notdef
        (void)snprintf(path, sizeof(path), "%s%s",
            (const char *)epp->ep_emul_arg, name);
        DPRINTF(("loading library %s\n", path));
@@ -539,6 +539,16 @@
            &epp->ep_entry, MACHO_MOH_EXECUTE)) != 0)
                goto bad;
 
+       /*
+        * stash a copy of the program name in epp->ep_emul_arg because
+        * might need it later.
+        */
+       MALLOC(epp->ep_emul_arg, char *, MAXPATHLEN, M_EXEC, M_WAITOK);
+       if ((error = copyinstr(epp->ep_name, epp->ep_emul_arg,
+           MAXPATHLEN, NULL)) != 0) {
+               DPRINTF(("Copyinstr %p failed\n", epp->ep_name));
+               goto bad;
+       }
        vn_marktext(epp->ep_vp);
        return exec_macho_setup_stack(p, epp);
 bad:



Home | Main Index | Thread Index | Old Index