From owner-svn-src-head@FreeBSD.ORG Thu Jan 9 20:06:15 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 51D0F2F2; Thu, 9 Jan 2014 20:06:15 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 3E4881908; Thu, 9 Jan 2014 20:06:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s09K6FRX000316; Thu, 9 Jan 2014 20:06:15 GMT (envelope-from lme@svn.freebsd.org) Received: (from lme@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s09K6F4t000315; Thu, 9 Jan 2014 20:06:15 GMT (envelope-from lme@svn.freebsd.org) Message-Id: <201401092006.s09K6F4t000315@svn.freebsd.org> From: Lars Engels Date: Thu, 9 Jan 2014 20:06:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260492 - head/sbin/geom/class/part X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Jan 2014 20:06:15 -0000 Author: lme (ports committer) Date: Thu Jan 9 20:06:14 2014 New Revision: 260492 URL: http://svnweb.freebsd.org/changeset/base/260492 Log: Check if the given argument to 'gpart add' is actually a geom device and give a hint to use 'gpart create' before trying to add a partition. Approved by: pjd Modified: head/sbin/geom/class/part/geom_part.c (contents, props changed) Modified: head/sbin/geom/class/part/geom_part.c ============================================================================== --- head/sbin/geom/class/part/geom_part.c Thu Jan 9 18:53:21 2014 (r260491) +++ head/sbin/geom/class/part/geom_part.c Thu Jan 9 20:06:14 2014 (r260492) @@ -454,8 +454,19 @@ gpart_autofill(struct gctl_req *req) if (s == NULL) abort(); gp = find_geom(cp, s); - if (gp == NULL) - errx(EXIT_FAILURE, "No such geom: %s.", s); + if (gp == NULL) { + if (g_device_path(s) == NULL) { + errx(EXIT_FAILURE, "No such geom %s.", s); + } else { + /* + * We don't free memory allocated by g_device_path() as + * we are about to exit. + */ + errx(EXIT_FAILURE, + "No partitioning scheme found on geom %s. Create one first using 'gpart create'.", + s); + } + } pp = LIST_FIRST(&gp->lg_consumer)->lg_provider; if (pp == NULL) errx(EXIT_FAILURE, "Provider for geom %s not found.", s);