Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Feb 2024 16:12:30 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 525e6d6c890f - main - loader/zfs: Fix to actually return the last error
Message-ID:  <202402291612.41TGCUJe007029@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=525e6d6c890f6aee898ac70347e5bb49da6638a1

commit 525e6d6c890f6aee898ac70347e5bb49da6638a1
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2024-02-27 05:47:38 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-02-29 16:12:21 +0000

    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
---
 stand/libsa/zfs/zfsimpl.c | 16 ++++++++--------
 1 file 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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202402291612.41TGCUJe007029>