Lines 144-162
libbe_init(const char *root)
Link Here
|
144 |
} else |
144 |
} else |
145 |
strlcpy(lbh->root, root, sizeof(lbh->root)); |
145 |
strlcpy(lbh->root, root, sizeof(lbh->root)); |
146 |
|
146 |
|
147 |
if ((pos = strchr(lbh->root, '/')) == NULL) |
147 |
if ((pos = strchr(lbh->root, '/')) == NULL) { |
148 |
goto err; |
148 |
if((lbh->active_phandle = zpool_open(lbh->lzh, lbh->root)) == NULL) |
149 |
|
149 |
goto err; |
150 |
pnamelen = pos - lbh->root; |
150 |
} else { |
151 |
poolname = malloc(pnamelen + 1); |
151 |
pnamelen = pos - lbh->root; |
152 |
if (poolname == NULL) |
152 |
poolname = malloc(pnamelen + 1); |
153 |
goto err; |
153 |
if (poolname == NULL) |
|
|
154 |
goto err; |
154 |
|
155 |
|
155 |
strlcpy(poolname, lbh->root, pnamelen + 1); |
156 |
strlcpy(poolname, lbh->root, pnamelen + 1); |
156 |
if ((lbh->active_phandle = zpool_open(lbh->lzh, poolname)) == NULL) |
157 |
if ((lbh->active_phandle = zpool_open(lbh->lzh, poolname)) == NULL) |
157 |
goto err; |
158 |
goto err; |
158 |
free(poolname); |
159 |
free(poolname); |
159 |
poolname = NULL; |
160 |
poolname = NULL; |
|
|
161 |
} |
160 |
|
162 |
|
161 |
if (zpool_get_prop(lbh->active_phandle, ZPOOL_PROP_BOOTFS, lbh->bootfs, |
163 |
if (zpool_get_prop(lbh->active_phandle, ZPOOL_PROP_BOOTFS, lbh->bootfs, |
162 |
sizeof(lbh->bootfs), NULL, true) != 0) |
164 |
sizeof(lbh->bootfs), NULL, true) != 0) |