sock: set errno in spdk_sock_flush()

All the other spdk_sock_* functions return -1 and set errno
appropriately, so we should do the same in flush().

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I51cda2c51974c72e82531f06fa31ab89b2329c91
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15642
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
This commit is contained in:
Konrad Sztyber 2022-11-24 13:45:30 +01:00
parent 3bc7e8f091
commit 0cae873b78
2 changed files with 4 additions and 2 deletions

View File

@ -516,7 +516,8 @@ int
spdk_sock_flush(struct spdk_sock *sock)
{
if (sock == NULL || sock->flags.closed) {
return -EBADF;
errno = EBADF;
return -1;
}
/* Sock is in a polling group, so group polling mechanism will work */

View File

@ -805,7 +805,8 @@ _sock_close(const char *ip, int port, char *impl_name)
/* Test spdk_sock_flush when sock is NULL */
rc = spdk_sock_flush(NULL);
CU_ASSERT(rc == -EBADF);
CU_ASSERT(rc == -1);
CU_ASSERT(errno == EBADF);
/* Test spdk_sock_flush when sock is not NULL */
rc = spdk_sock_flush(client_sock);