Make fail() preserve the errno.

MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Edward Tomasz Napierala 2016-03-15 11:10:08 +00:00
parent e19462c33b
commit 535bd9beaf

View File

@ -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;
}
/*