Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/man move 'utsname' to the main() function scope, so ...



details:   https://anonhg.NetBSD.org/src/rev/1764dac35d60
branches:  trunk
changeset: 833215:1764dac35d60
user:      mrg <mrg%NetBSD.org@localhost>
date:      Fri Jun 15 20:16:35 2018 +0000

description:
move 'utsname' to the main() function scope, so that the reference to
it outside the block remains valid.

should fix an asan reported issue.

diffstat:

 usr.bin/man/man.c |  7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diffs (35 lines):

diff -r 5eaff1cdc10d -r 1764dac35d60 usr.bin/man/man.c
--- a/usr.bin/man/man.c Fri Jun 15 19:52:01 2018 +0000
+++ b/usr.bin/man/man.c Fri Jun 15 20:16:35 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: man.c,v 1.66 2017/05/02 14:19:23 abhinav Exp $ */
+/*     $NetBSD: man.c,v 1.67 2018/06/15 20:16:35 mrg Exp $     */
 
 /*
  * Copyright (c) 1987, 1993, 1994, 1995
@@ -40,7 +40,7 @@
 #if 0
 static char sccsid[] = "@(#)man.c      8.17 (Berkeley) 1/31/95";
 #else
-__RCSID("$NetBSD: man.c,v 1.66 2017/05/02 14:19:23 abhinav Exp $");
+__RCSID("$NetBSD: man.c,v 1.67 2018/06/15 20:16:35 mrg Exp $");
 #endif
 #endif /* not lint */
 
@@ -128,6 +128,7 @@
 main(int argc, char **argv)
 {
        static struct manstate m;
+       struct utsname utsname;
        int ch, abs_section, found;
        ENTRY *esubd, *epath;
        char *p, **ap, *cmd;
@@ -204,8 +205,6 @@
        config(m.conffile);    /* exits on error ... */
 
        if ((m.machine = getenv("MACHINE")) == NULL) {
-               struct utsname utsname;
-
                if (uname(&utsname) == -1)
                        err(EXIT_FAILURE, "uname");
                m.machine = utsname.machine;



Home | Main Index | Thread Index | Old Index