Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 30 Sep 2007 16:10:07 GMT
From:      =?ISO-8859-1?Q?R=E9mi_Guyomarch?= <rguyom@pobox.com>
To:        freebsd-rc@FreeBSD.org
Subject:   Re: conf/116177: rc.d/mdconfig2 script fail at -CURRENT
Message-ID:  <200709301610.l8UGA7OD083398@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR conf/116177; it has been noted by GNATS.

From: =?ISO-8859-1?Q?R=E9mi_Guyomarch?= <rguyom@pobox.com>
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);
   }
 
   /*
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200709301610.l8UGA7OD083398>