summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2019-04-01 00:12:03 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2019-04-01 00:12:03 +0000
commit46acd545973d502b0603cc98f6ae78cb9d49e5c0 (patch)
treee548f916e6e894d075d06b9824cf4f298010ba0e
parente228823ec57ade4d373dd3d85ae187b6f17c9772 (diff)
No need to save/restore fields across the invocation of
getasciilabel() when getasciilabel() explicitly avoids changing those fields. ok otto@
-rw-r--r--sbin/disklabel/disklabel.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/sbin/disklabel/disklabel.c b/sbin/disklabel/disklabel.c
index e1cda9e358a..552b1e1dad7 100644
--- a/sbin/disklabel/disklabel.c
+++ b/sbin/disklabel/disklabel.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disklabel.c,v 1.230 2018/08/11 18:37:21 krw Exp $ */
+/* $OpenBSD: disklabel.c,v 1.231 2019/04/01 00:12:02 krw Exp $ */
/*
* Copyright (c) 1987, 1993
@@ -648,7 +648,6 @@ edit(struct disklabel *lp, int f)
int first, ch, fd, error = 0;
struct disklabel label;
FILE *fp;
- u_int64_t total_sectors, starting_sector, ending_sector;
if ((fd = mkstemp(tmpfil)) == -1 || (fp = fdopen(fd, "w")) == NULL) {
warn("%s", tmpfil);
@@ -674,17 +673,10 @@ edit(struct disklabel *lp, int f)
warn("%s", tmpfil);
break;
}
- /* Get values set by OS and not the label. */
+ /* Start with the kernel's idea of the default label. */
if (ioctl(f, DIOCGPDINFO, &label) < 0)
err(4, "ioctl DIOCGPDINFO");
- ending_sector = DL_GETBEND(&label);
- starting_sector = DL_GETBSTART(&label);
- total_sectors = DL_GETDSIZE(&label);
error = getasciilabel(fp, &label);
- DL_SETBEND(&label, ending_sector);
- DL_SETBSTART(&label, starting_sector);
- DL_SETDSIZE(&label, total_sectors);
-
if (error == 0) {
if (cmplabel(lp, &label) == 0) {
puts("No changes.");