Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/gpt Make the "gpt header" command return EXIT_FAILURE w...



details:   https://anonhg.NetBSD.org/src/rev/5a7c193676aa
branches:  trunk
changeset: 832138:5a7c193676aa
user:      martin <martin%NetBSD.org@localhost>
date:      Tue May 01 08:17:13 2018 +0000

description:
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.

diffstat:

 sbin/gpt/gpt.8    |  8 +++++++-
 sbin/gpt/header.c |  4 ++--
 2 files changed, 9 insertions(+), 3 deletions(-)

diffs (43 lines):

diff -r a6d94a3fcfc1 -r 5a7c193676aa sbin/gpt/gpt.8
--- a/sbin/gpt/gpt.8    Tue May 01 08:16:34 2018 +0000
+++ b/sbin/gpt/gpt.8    Tue May 01 08:17:13 2018 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: gpt.8,v 1.59 2018/04/11 07:13:18 mrg Exp $
+.\" $NetBSD: gpt.8,v 1.60 2018/05/01 08:17:13 martin Exp $
 .\"
 .\" Copyright (c) 2002 Marcel Moolenaar
 .\" All rights reserved.
@@ -735,6 +735,12 @@
 xotica# mount /dev/dk0 /mnt
 xotica# cp /usr/mdec/boot /mnt
 .Ed
+.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 existance of a GPT in shell scripts.
 .Sh SEE ALSO
 .Xr boot 8 ,
 .Xr dkctl 8 ,
diff -r a6d94a3fcfc1 -r 5a7c193676aa sbin/gpt/header.c
--- a/sbin/gpt/header.c Tue May 01 08:16:34 2018 +0000
+++ b/sbin/gpt/header.c Tue May 01 08:17:13 2018 +0000
@@ -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.9 2018/05/01 08:17:13 martin Exp $");
 #endif
 
 #include <sys/types.h>
@@ -83,7 +83,7 @@
        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;



Home | Main Index | Thread Index | Old Index