diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2008-06-04 01:27:55 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2008-06-04 01:27:55 +0000 |
commit | b2af265a8f156cc932202d31d4650c3d437386b0 (patch) | |
tree | 410baaf4548186aa82e0d0c5ca72d943c7fb2da6 | |
parent | 1a4158bb8e92781f2de807dbf963b8909de8f693 (diff) |
setbootflag() must be done before checksum'ing the label. Bug introduced
in 1.126, found by nick during a test install; ok krw
-rw-r--r-- | sbin/disklabel/disklabel.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sbin/disklabel/disklabel.c b/sbin/disklabel/disklabel.c index 12d5f22c307..3352bff5c00 100644 --- a/sbin/disklabel/disklabel.c +++ b/sbin/disklabel/disklabel.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disklabel.c,v 1.127 2008/04/07 23:37:14 krw Exp $ */ +/* $OpenBSD: disklabel.c,v 1.128 2008/06/04 01:27:54 deraadt Exp $ */ /* * Copyright (c) 1987, 1993 @@ -39,7 +39,7 @@ static const char copyright[] = #endif /* not lint */ #ifndef lint -static const char rcsid[] = "$OpenBSD: disklabel.c,v 1.127 2008/04/07 23:37:14 krw Exp $"; +static const char rcsid[] = "$OpenBSD: disklabel.c,v 1.128 2008/06/04 01:27:54 deraadt Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -388,12 +388,14 @@ writelabel(int f, char *boot, struct disklabel *lp) int writeable; off_t sectoffset = 0; +#if NUMBOOT > 0 + setbootflag(lp); +#endif lp->d_magic = DISKMAGIC; lp->d_magic2 = DISKMAGIC; lp->d_checksum = 0; lp->d_checksum = dkcksum(lp); #if NUMBOOT > 0 - setbootflag(lp); if (installboot) { #ifdef DOSLABEL struct partition *pp = &lp->d_partitions[2]; |