aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGleb Smirnoff <glebius@FreeBSD.org>2024-02-20 03:51:22 +0000
committerGleb Smirnoff <glebius@FreeBSD.org>2024-02-20 03:51:22 +0000
commit0c3ade2cf13df1ed5cd9db4081137ec90fcd19d0 (patch)
treedcfb1148a482f6f0a456e28c60a188d8af499fa3
parent3aefe6759669bbadeb1a24a8956bf222ce279c68 (diff)
nextboot: fix nextboot -k on ZFS
zfsbootcfg(1) expects pool name to operate on, not currently mounted filesystem name. Fixes: fd6d47375a78fbf0737012b7cc11180291781e8b
-rw-r--r--sbin/reboot/reboot.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/sbin/reboot/reboot.c b/sbin/reboot/reboot.c
index 7ea4d50eaf74..ac3927cc2432 100644
--- a/sbin/reboot/reboot.c
+++ b/sbin/reboot/reboot.c
@@ -130,6 +130,11 @@ write_nextboot(const char *fn, const char *env, bool force)
}
if (zfs) {
+ char *slash;
+
+ if ((slash = strchr(sfs.f_mntfromname, '/')) == NULL)
+ E("Can't find ZFS pool name in %s", sfs.f_mntfromname);
+ *slash = '\0';
zfsbootcfg(sfs.f_mntfromname, force);
}