diff --git a/usr.sbin/iscsid/iscsid.c b/usr.sbin/iscsid/iscsid.c index 72828ef572b6..5be7a44ce58e 100644 --- a/usr.sbin/iscsid/iscsid.c +++ b/usr.sbin/iscsid/iscsid.c @@ -290,7 +290,9 @@ void fail(const struct connection *conn, const char *reason) { struct iscsi_daemon_fail idf; - int error; + int error, saved_errno; + + saved_errno = errno; memset(&idf, 0, sizeof(idf)); idf.idf_session_id = conn->conn_session_id; @@ -299,6 +301,8 @@ fail(const struct connection *conn, const char *reason) error = ioctl(conn->conn_iscsi_fd, ISCSIDFAIL, &idf); if (error != 0) log_err(1, "ISCSIDFAIL"); + + errno = saved_errno; } /*