Source-Changes-HG archive

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

[src/trunk]: src/libexec/ld.elf_so If the environment is corrupt, die. From F...



details:   https://anonhg.NetBSD.org/src/rev/73c1e1ddc4e5
branches:  trunk
changeset: 749567:73c1e1ddc4e5
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Dec 02 15:50:13 2009 +0000

description:
If the environment is corrupt, die. From FreeBSD.

diffstat:

 libexec/ld.elf_so/rtld.c |  11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diffs (39 lines):

diff -r 8c23637ada0c -r 73c1e1ddc4e5 libexec/ld.elf_so/rtld.c
--- a/libexec/ld.elf_so/rtld.c  Wed Dec 02 15:47:45 2009 +0000
+++ b/libexec/ld.elf_so/rtld.c  Wed Dec 02 15:50:13 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rtld.c,v 1.126 2009/11/17 18:44:33 skrll Exp $  */
+/*     $NetBSD: rtld.c,v 1.127 2009/12/02 15:50:13 christos Exp $       */
 
 /*
  * Copyright 1996 John D. Polstra.
@@ -40,7 +40,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: rtld.c,v 1.126 2009/11/17 18:44:33 skrll Exp $");
+__RCSID("$NetBSD: rtld.c,v 1.127 2009/12/02 15:50:13 christos Exp $");
 #endif /* not lint */
 
 #include <err.h>
@@ -439,8 +439,8 @@
                    getenv("LD_LIBRARY_PATH"));
        } else {
                execname = NULL;
-               unsetenv("LD_DEBUG");
-               unsetenv("LD_LIBRARY_PATH");
+               if (unsetenv("LD_DEBUG") || unsetenv("LD_LIBRARY_PATH"))
+                       _rtld_die();
        }
        _rtld_process_hints(execname, &_rtld_paths, &_rtld_xforms,
            _PATH_LD_HINTS);
@@ -514,7 +514,8 @@
                if (_rtld_preload(getenv("LD_PRELOAD")) == -1)
                        _rtld_die();
        } else
-               unsetenv("LD_PRELOAD");
+               if (unsetenv("LD_PRELOAD"))
+                       _rtld_die();
 
        dbg(("loading needed objects"));
        if (_rtld_load_needed_objects(_rtld_objmain, RTLD_MAIN) == -1)



Home | Main Index | Thread Index | Old Index