Source-Changes-HG archive

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

[src/trunk]: src/sbin/disklabel first check, then copy



details:   https://anonhg.NetBSD.org/src/rev/1790c22617fd
branches:  trunk
changeset: 983567:1790c22617fd
user:      christos <christos%NetBSD.org@localhost>
date:      Sat May 29 17:41:51 2021 +0000

description:
first check, then copy

diffstat:

 sbin/disklabel/main.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (29 lines):

diff -r 71a1c9b12cb2 -r 1790c22617fd sbin/disklabel/main.c
--- a/sbin/disklabel/main.c     Sat May 29 16:51:25 2021 +0000
+++ b/sbin/disklabel/main.c     Sat May 29 17:41:51 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.55 2020/09/29 02:58:52 msaitoh Exp $        */
+/*     $NetBSD: main.c,v 1.56 2021/05/29 17:41:51 christos Exp $       */
 
 /*
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -76,7 +76,7 @@
 static char sccsid[] = "@(#)disklabel.c        8.4 (Berkeley) 5/4/95";
 /* from static char sccsid[] = "@(#)disklabel.c        1.2 (Symmetric) 11/28/85"; */
 #else
-__RCSID("$NetBSD: main.c,v 1.55 2020/09/29 02:58:52 msaitoh Exp $");
+__RCSID("$NetBSD: main.c,v 1.56 2021/05/29 17:41:51 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -1238,9 +1238,9 @@
                if (i == LABEL_OFFSET)
                        continue;
                disk_lp = (void *)(bootarea + offset);
-               memcpy(&tlp, disk_lp, sizeof(tlp));
                if ((char *)(disk_lp + 1) > bootarea + bootarea_len)
                        break;
+               memcpy(&tlp, disk_lp, sizeof(tlp));
                if (tlp.d_magic2 != tlp.d_magic)
                        continue;
                if (read_all && (tlp.d_magic == DISKMAGIC_DELETED ||



Home | Main Index | Thread Index | Old Index