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 don't core dump setting progname if argv[0...



details:   https://anonhg.NetBSD.org/src/rev/b7bea2ea40b3
branches:  trunk
changeset: 536628:b7bea2ea40b3
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Sep 19 13:59:46 2002 +0000

description:
don't core dump setting progname if argv[0] == NULL. From xs%kittenz.org@localhost

diffstat:

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

diffs (28 lines):

diff -r fdcf450b8639 -r b7bea2ea40b3 libexec/ld.elf_so/rtld.c
--- a/libexec/ld.elf_so/rtld.c  Thu Sep 19 13:04:02 2002 +0000
+++ b/libexec/ld.elf_so/rtld.c  Thu Sep 19 13:59:46 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rtld.c,v 1.63 2002/09/13 15:27:30 mycroft Exp $         */
+/*     $NetBSD: rtld.c,v 1.64 2002/09/19 13:59:46 christos Exp $        */
 
 /*
  * Copyright 1996 John D. Polstra.
@@ -495,10 +495,14 @@
         */
        real___progname = _rtld_objmain_sym("__progname");
        if (real___progname) {
-               if ((*real___progname = strrchr(argv[0], '/')) == NULL)
-                       (*real___progname) = argv[0];
-               else
-                       (*real___progname)++;
+               if (argv[0] != NULL) {
+                       if ((*real___progname = strrchr(argv[0], '/')) == NULL)
+                               (*real___progname) = argv[0];
+                       else
+                               (*real___progname)++;
+               } else {
+                       (*real___progname) = NULL;
+               }
        }
        real_environ = _rtld_objmain_sym("environ");
        if (real_environ)



Home | Main Index | Thread Index | Old Index