Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/sysinst/arch/sgimips PR port-sgimips/53583: fetch k...



details:   https://anonhg.NetBSD.org/src/rev/ebb447ffa7f2
branches:  trunk
changeset: 433341:ebb447ffa7f2
user:      martin <martin%NetBSD.org@localhost>
date:      Sat Sep 08 18:10:35 2018 +0000

description:
PR port-sgimips/53583: fetch kernel name always before using it.
Make the struct utsname local to avoid future similar issues.

diffstat:

 usr.sbin/sysinst/arch/sgimips/md.c |  15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diffs (59 lines):

diff -r 8d68223a7130 -r ebb447ffa7f2 usr.sbin/sysinst/arch/sgimips/md.c
--- a/usr.sbin/sysinst/arch/sgimips/md.c        Sat Sep 08 14:32:25 2018 +0000
+++ b/usr.sbin/sysinst/arch/sgimips/md.c        Sat Sep 08 18:10:35 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: md.c,v 1.4 2018/03/17 22:27:04 jmcneill Exp $  */
+/*     $NetBSD: md.c,v 1.5 2018/09/08 18:10:35 martin Exp $    */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -51,7 +51,6 @@
 #include "msg_defs.h"
 #include "menu_defs.h"
 
-struct utsname instsys;
 
 void
 md_init(void)
@@ -61,13 +60,15 @@
 void
 md_init_set_status(int flags)
 {
+       struct utsname instsys;
+
        (void)flags;
 
         /*
          * Get the name of the Install Kernel we are running under and
          * enable the installation of the corresponding GENERIC kernel.
          */
-        uname(&instsys);
+       uname(&instsys);
         if (strstr(instsys.version, "(INSTALL32_IP3x"))
                 set_kernel_set(SET_KERNEL_2);
         else if (strstr(instsys.version, "(INSTALL32_IP2x"))
@@ -156,7 +157,10 @@
 int
 md_post_disklabel(void)
 {
-    if (strstr(instsys.version, "(INSTALL32_IP3x"))
+       struct utsname instsys;
+       uname(&instsys);
+ 
+       if (strstr(instsys.version, "(INSTALL32_IP3x"))
                return run_program(RUN_DISPLAY,
                    "%s %s", "/usr/mdec/sgivol -f -w boot /usr/mdec/ip3xboot",
                    pm->diskdev);
@@ -194,9 +198,12 @@
 void
 md_cleanup_install(void)
 {
+       struct utsname instsys;
+
 #ifndef DEBUG
        enable_rc_conf();
 #endif
+       uname(&instsys);
 
        if (strstr(instsys.version, "(GENERIC32_IP12"))
                run_program(0, "/usr/mdec/sgivol -f -w netbsd %s %s",



Home | Main Index | Thread Index | Old Index