From owner-freebsd-rc@FreeBSD.ORG Sun Sep 30 16:10:08 2007 Return-Path: Delivered-To: freebsd-rc@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5E2CC16A418 for ; Sun, 30 Sep 2007 16:10:08 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 2BD9C13C46E for ; Sun, 30 Sep 2007 16:10:08 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.1/8.14.1) with ESMTP id l8UGA780083399 for ; Sun, 30 Sep 2007 16:10:07 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.1/8.14.1/Submit) id l8UGA7OD083398; Sun, 30 Sep 2007 16:10:07 GMT (envelope-from gnats) Date: Sun, 30 Sep 2007 16:10:07 GMT Message-Id: <200709301610.l8UGA7OD083398@freefall.freebsd.org> To: freebsd-rc@FreeBSD.org From: =?ISO-8859-1?Q?R=E9mi_Guyomarch?= Cc: Subject: Re: conf/116177: rc.d/mdconfig2 script fail at -CURRENT X-BeenThere: freebsd-rc@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: =?ISO-8859-1?Q?R=E9mi_Guyomarch?= List-Id: "Discussion related to /etc/rc.d design and implementation." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Sep 2007 16:10:08 -0000 The following reply was made to PR conf/116177; it has been noted by GNATS. From: =?ISO-8859-1?Q?R=E9mi_Guyomarch?= To: bug-followup@FreeBSD.org, dindin@dindin.ru Cc: Subject: Re: conf/116177: rc.d/mdconfig2 script fail at -CURRENT Date: Sun, 30 Sep 2007 16:57:42 +0200 I had the exact same problem but I fixed it by patching /sbin/mdconfig instead. With this patch, "/sbin/mdconfig -l -u md0" will return 0 if md0 exists and -1 if not. It has the advantage of fixing the bug in both /etc/rc.d/mdconfig and /etc/rc.d/mdconfig2. --- /usr/src/sbin/mdconfig/mdconfig.c~ 2007-09-30 15:25:16.000000000 +0200 +++ /usr/src/sbin/mdconfig/mdconfig.c 2007-09-30 15:25:16.000000000 +0200 @@ -284,7 +284,7 @@ */ md_list(NULL, OPT_LIST); } else { - md_query(mdunit); + return (md_query(mdunit)); } } else if (action == ATTACH) { if (cmdline < 2) @@ -323,7 +323,7 @@ struct ggeom *gg; struct gclass *gcl; void *sq; - int retcode; + int retcode, found; char *type, *file, *length; type = file = length = NULL; @@ -338,6 +338,7 @@ if (sq == NULL) return (-1); + found = 0; while ((gsp = geom_stats_snapshot_next(sq)) != NULL) { gid = geom_lookupid(&gm, gsp->id); if (gid == NULL) @@ -352,6 +353,8 @@ retcode = md_find(units, pp->lg_name); if (retcode != 1) continue; + else + found = 1; } gc = &pp->lg_config; printf("%s", pp->lg_name); @@ -380,7 +383,10 @@ printf("\n"); /* XXX: Check if it's enough to clean everything. */ geom_stats_snapshot_free(sq); - return (-1); + if ((opt & OPT_UNIT) && found) + return (0); + else + return (-1); } /*