Simplify and get rid of external "grep" dependency which is not available

on all install meadia.
Sugested by kre.
This commit is contained in:
martin 2018-05-01 09:01:45 +00:00
parent aebb419bf1
commit 371d88511b
1 changed files with 4 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: disks.c,v 1.13 2017/01/13 05:49:27 christos Exp $ */
/* $NetBSD: disks.c,v 1.14 2018/05/01 09:01:45 martin Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -1480,11 +1480,12 @@ incoregpt(pm_devs_t *pm_cur, partinfo *lp)
static bool
is_gpt(const char *dev)
{
check_available_binaries();
if (!have_gpt)
return false;
return !run_program(RUN_SILENT | RUN_ERROR_OK,
"sh -c 'gpt show %s |grep -e Pri\\ GPT\\ table'", dev);
return run_program(RUN_SILENT | RUN_ERROR_OK,
"gpt -qr header %s", dev) == 0;
}