summaryrefslogtreecommitdiffstats
path: root/sbin/disklabel/editor.c
diff options
context:
space:
mode:
authorkrw <krw@openbsd.org>2009-05-29 01:49:56 +0000
committerkrw <krw@openbsd.org>2009-05-29 01:49:56 +0000
commitf52242c6f515545815d2fd4f9c2673ba15de12d0 (patch)
tree8630cdf239e8987191e39e64abbcff69c88aff9b /sbin/disklabel/editor.c
parentRemember to copy the modified ntpd.conf back to /etc (diff)
downloadwireguard-openbsd-f52242c6f515545815d2fd4f9c2673ba15de12d0.tar.xz
wireguard-openbsd-f52242c6f515545815d2fd4f9c2673ba15de12d0.zip
Clean up logic around exit values. Make getasciilabel() return 0
for success. Fix a couple of bugs where errors in checklabel() got lost. Make Editor 'q' and 'x' commands exit with 0 (ok) rather than 1. i.e. non-zero exit value now reserved for failure, not a decision to leave the disklabel unchanged. This allows the install script to use the exit value to catch failures to write a disklabel.
Diffstat (limited to 'sbin/disklabel/editor.c')
-rw-r--r--sbin/disklabel/editor.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sbin/disklabel/editor.c b/sbin/disklabel/editor.c
index d958136642b..37ae40d1b17 100644
--- a/sbin/disklabel/editor.c
+++ b/sbin/disklabel/editor.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: editor.c,v 1.212 2009/05/17 02:49:45 krw Exp $ */
+/* $OpenBSD: editor.c,v 1.213 2009/05/29 01:49:56 krw Exp $ */
/*
* Copyright (c) 1997-2000 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -17,7 +17,7 @@
*/
#ifndef lint
-static char rcsid[] = "$OpenBSD: editor.c,v 1.212 2009/05/17 02:49:45 krw Exp $";
+static char rcsid[] = "$OpenBSD: editor.c,v 1.213 2009/05/29 01:49:56 krw Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -340,7 +340,7 @@ editor(struct disklabel *lp, int f)
case 'q':
if (donothing) {
puts("In no change mode, not writing label.");
- return(1);
+ return(0);
}
/* Save mountpoint info if there is any. */
mpsave(&label);
@@ -355,7 +355,7 @@ editor(struct disklabel *lp, int f)
if (!dflag && !aflag &&
memcmp(lp, &label, sizeof(label)) == 0) {
puts("No label changes.");
- return(1);
+ return(0);
}
do {
arg = getstring("Write new label?",
@@ -454,7 +454,7 @@ editor(struct disklabel *lp, int f)
break;
case 'x':
- return(1);
+ return(0);
break;
case 'z':