aboutsummaryrefslogtreecommitdiff
path: root/sys/contrib/openzfs/lib/libzfsbootenv/lzbe_device.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/contrib/openzfs/lib/libzfsbootenv/lzbe_device.c')
-rw-r--r--sys/contrib/openzfs/lib/libzfsbootenv/lzbe_device.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/sys/contrib/openzfs/lib/libzfsbootenv/lzbe_device.c b/sys/contrib/openzfs/lib/libzfsbootenv/lzbe_device.c
index 21007fd9ef50..894471a9bf35 100644
--- a/sys/contrib/openzfs/lib/libzfsbootenv/lzbe_device.c
+++ b/sys/contrib/openzfs/lib/libzfsbootenv/lzbe_device.c
@@ -116,7 +116,7 @@ lzbe_get_boot_device(const char *pool, char **device)
libzfs_handle_t *hdl;
zpool_handle_t *zphdl;
nvlist_t *nv;
- char *val;
+ const char *val;
int rv = -1;
if (pool == NULL || *pool == '\0' || device == NULL)
@@ -140,14 +140,13 @@ lzbe_get_boot_device(const char *pool, char **device)
* we only do need dataset name.
*/
if (strncmp(val, "zfs:", 4) == 0) {
- val += 4;
- val = strdup(val);
- if (val != NULL) {
- size_t len = strlen(val);
-
- if (val[len - 1] == ':')
- val[len - 1] = '\0';
- *device = val;
+ char *tmp = strdup(val + 4);
+ if (tmp != NULL) {
+ size_t len = strlen(tmp);
+
+ if (tmp[len - 1] == ':')
+ tmp[len - 1] = '\0';
+ *device = tmp;
} else {
rv = ENOMEM;
}