summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authortrasz <trasz@FreeBSD.org>2016-03-15 11:10:08 +0000
committertrasz <trasz@FreeBSD.org>2016-03-15 11:10:08 +0000
commit291073f1f074d2ead3a697d6a2f470d595c9b026 (patch)
tree6f2f01b3a209d5660baf63c83a2b850db1b4da4d /usr.sbin
parentd59afb0080ef4e4c627fe9239305124e719048a5 (diff)
downloadFreeBSD-src-291073f1f074d2ead3a697d6a2f470d595c9b026.zip
FreeBSD-src-291073f1f074d2ead3a697d6a2f470d595c9b026.tar.gz
Make fail() preserve the errno.
MFC after: 1 month Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/iscsid/iscsid.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.sbin/iscsid/iscsid.c b/usr.sbin/iscsid/iscsid.c
index 72828ef..5be7a44 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;
}
/*
OpenPOWER on IntegriCloud