diff options
Diffstat (limited to 'sbin/gvinum/gvinum.c')
-rw-r--r-- | sbin/gvinum/gvinum.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/sbin/gvinum/gvinum.c b/sbin/gvinum/gvinum.c index 31974a9..278a268 100644 --- a/sbin/gvinum/gvinum.c +++ b/sbin/gvinum/gvinum.c @@ -423,6 +423,7 @@ create_drive(char *device) const char *errstr; char *drivename, *dname; int drives, i, flags, volumes, subdisks, plexes; + int found = 0; flags = plexes = subdisks = volumes = 0; drives = 1; @@ -450,10 +451,8 @@ create_drive(char *device) errstr = gctl_issue(req); if (errstr != NULL) { warnx("error creating drive: %s", errstr); - gctl_free(req); - return (NULL); + drivename = NULL; } else { - gctl_free(req); /* XXX: This is needed because we have to make sure the drives * are created before we return. */ /* Loop until it's in the config. */ @@ -463,14 +462,18 @@ create_drive(char *device) /* If we got a different name, quit. */ if (dname == NULL) continue; - if (strcmp(dname, drivename)) { - free(dname); - return (drivename); - } + if (strcmp(dname, drivename)) + found = 1; free(dname); dname = NULL; + if (found) + break; usleep(100000); /* Sleep for 0.1s */ } + if (found == 0) { + warnx("error creating drive"); + drivename = NULL; + } } gctl_free(req); return (drivename); |