krb5_storage_free(): preserve errno

This commit is contained in:
Nicolas Williams
2016-01-26 18:56:06 -06:00
parent 996d4c5db3
commit abafa0a0a0
2 changed files with 8 additions and 2 deletions

View File

@@ -111,7 +111,9 @@ fd_sync(krb5_storage * sp)
static void
fd_free(krb5_storage * sp)
{
close(FD(sp));
int save_errno = errno;
if (close(FD(sp)) == 0)
errno = save_errno;
}
/**

View File

@@ -81,7 +81,11 @@ socket_sync(krb5_storage * sp)
static void
socket_free(krb5_storage * sp)
{
rk_closesocket(SOCK(sp));
int save_errno = errno;
if (rk_IS_SOCKET_ERROR(rk_closesocket(SOCK(sp))))
errno = rk_SOCK_ERRNO;
else
errno = save_errno;
}
/**