Module Name:    src
Committed By:   mrg
Date:           Fri Jun 15 20:16:35 UTC 2018

Modified Files:
        src/usr.bin/man: man.c

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

should fix an asan reported issue.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/usr.bin/man/man.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/man/man.c
diff -u src/usr.bin/man/man.c:1.66 src/usr.bin/man/man.c:1.67
--- src/usr.bin/man/man.c:1.66	Tue May  2 14:19:23 2017
+++ src/usr.bin/man/man.c	Fri Jun 15 20:16:35 2018
@@ -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 @@ __COPYRIGHT("@(#) Copyright (c) 1987, 19
 #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 @@ int
 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 @@ main(int argc, char **argv)
 	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;

Reply via email to