Module Name:    src
Committed By:   snj
Date:           Mon May  7 04:00:18 UTC 2018

Modified Files:
        src/sbin/gpt [netbsd-8]: gpt.8 header.c

Log Message:
Pull up following revision(s) (requested by martin in ticket #797):
        sbin/gpt/gpt.8: 1.60-1.63
        sbin/gpt/header.c: 1.9
Make the "gpt header" command return EXIT_FAILURE when no GPT is present.
This helps sysinst to tell a GPT labeled disk from others.
Very lazy version of a change proposed by kre.
--
Sort sections.
--
Bump date for new EXIT STATUS section.
--
Spello.   (it is "existence").
ispell also says that we should s/parseable/parsable/ but I'm
not sure about that one, so I left it.
I also left a correct spelling that no-one has bothered to mangle!


To generate a diff of this commit:
cvs rdiff -u -r1.52.4.2 -r1.52.4.3 src/sbin/gpt/gpt.8
cvs rdiff -u -r1.8 -r1.8.8.1 src/sbin/gpt/header.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sbin/gpt/gpt.8
diff -u src/sbin/gpt/gpt.8:1.52.4.2 src/sbin/gpt/gpt.8:1.52.4.3
--- src/sbin/gpt/gpt.8:1.52.4.2	Fri May  4 16:24:46 2018
+++ src/sbin/gpt/gpt.8	Mon May  7 04:00:18 2018
@@ -1,4 +1,4 @@
-.\" $NetBSD: gpt.8,v 1.52.4.2 2018/05/04 16:24:46 martin Exp $
+.\" $NetBSD: gpt.8,v 1.52.4.3 2018/05/07 04:00:18 snj Exp $
 .\"
 .\" Copyright (c) 2002 Marcel Moolenaar
 .\" All rights reserved.
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD: src/sbin/gpt/gpt.8,v 1.17 2006/06/22 22:22:32 marcel Exp $
 .\"
-.Dd March 5, 2018
+.Dd May 1, 2018
 .Dt GPT 8
 .Os
 .Sh NAME
@@ -678,6 +678,12 @@ They may be used by
 .Nx
 code in the future.
 .El
+.Sh EXIT STATUS
+The
+.Nm
+command exits with a failure status (1) when the header command
+is used and no GPT header is found.
+This can be used to check for the existence of a GPT in shell scripts.
 .Sh EXAMPLES
 .Bd -literal
 nas# gpt show wd3

Index: src/sbin/gpt/header.c
diff -u src/sbin/gpt/header.c:1.8 src/sbin/gpt/header.c:1.8.8.1
--- src/sbin/gpt/header.c:1.8	Thu Dec 24 17:35:57 2015
+++ src/sbin/gpt/header.c	Mon May  7 04:00:18 2018
@@ -33,7 +33,7 @@
 
 #include <sys/cdefs.h>
 #ifdef __RCSID
-__RCSID("$NetBSD: header.c,v 1.8 2015/12/24 17:35:57 martin Exp $");
+__RCSID("$NetBSD: header.c,v 1.8.8.1 2018/05/07 04:00:18 snj Exp $");
 #endif
 
 #include <sys/types.h>
@@ -83,7 +83,7 @@ header(gpt_t gpt)
 	map = map_find(gpt, MAP_TYPE_PRI_GPT_HDR);
 	if (map == NULL) {
 		printf("- GPT Header not found\n");
-		return 0;
+		return -1;
 	}
 
 	hdr = map->map_data;

Reply via email to