aboutsummaryrefslogtreecommitdiff
path: root/stand
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2024-02-27 05:47:38 +0000
committerWarner Losh <imp@FreeBSD.org>2024-02-29 16:12:21 +0000
commit525e6d6c890f6aee898ac70347e5bb49da6638a1 (patch)
tree33d545dd8afdf8e5f54b396a82cd863e4dcbf62b /stand
parentaa80cfadff0bb715ca090cbd1b3561a1619251d5 (diff)
downloadsrc-525e6d6c890f6aee898ac70347e5bb49da6638a1.tar.gz
src-525e6d6c890f6aee898ac70347e5bb49da6638a1.zip
loader/zfs: Fix to actually return the last error
The last fix, to try to return the last error, really returns the first return code after the last error, which could be zero. Instead, return the last error. Also, change rc to err to make it visually distinct from rv, which is the cause of my error in e54bb0ad8058. Reported by: Bill Sommerfeld <sommerfeld@hamachi.org> Fixes: e54bb0ad8058 Sponsored by: Netflix
Diffstat (limited to 'stand')
-rw-r--r--stand/libsa/zfs/zfsimpl.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/stand/libsa/zfs/zfsimpl.c b/stand/libsa/zfs/zfsimpl.c
index e37582006c7a..41ef5a46f30e 100644
--- a/stand/libsa/zfs/zfsimpl.c
+++ b/stand/libsa/zfs/zfsimpl.c
@@ -1681,14 +1681,14 @@ static int
vdev_write_bootenv_impl(vdev_t *vdev, vdev_boot_envblock_t *be)
{
vdev_t *kid;
- int rv = 0, rc;
+ int rv = 0, err;
STAILQ_FOREACH(kid, &vdev->v_children, v_childlink) {
if (kid->v_state != VDEV_STATE_HEALTHY)
continue;
- rc = vdev_write_bootenv_impl(kid, be);
- if (rv != 0)
- rv = rc;
+ err = vdev_write_bootenv_impl(kid, be);
+ if (err != 0)
+ rv = err;
}
/*
@@ -1698,12 +1698,12 @@ vdev_write_bootenv_impl(vdev_t *vdev, vdev_boot_envblock_t *be)
return (rv);
for (int l = 0; l < VDEV_LABELS; l++) {
- rc = vdev_label_write(vdev, l, be,
+ err = vdev_label_write(vdev, l, be,
offsetof(vdev_label_t, vl_be));
- if (rc != 0) {
+ if (err != 0) {
printf("failed to write bootenv to %s label %d: %d\n",
- vdev->v_name ? vdev->v_name : "unknown", l, rc);
- rv = rc;
+ vdev->v_name ? vdev->v_name : "unknown", l, err);
+ rv = err;
}
}
return (rv);