diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2009-05-29 01:49:57 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2009-05-29 01:49:57 +0000 |
commit | 87d5711839a38fd20c41eeeea639be7ec43beac3 (patch) | |
tree | ba45f3823e45fb7c963bc1c2bf9605c80ab9510c /sbin/disklabel/editor.c | |
parent | b463445cd7d52203a347452777be48abfdb8a4d8 (diff) |
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.c | 10 |
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': |