From: Sebastian Harl Date: Wed, 25 Jun 2014 21:07:33 +0000 (+0200) Subject: client: Added sdb_client_shutdown(). X-Git-Tag: sysdb-0.2.0~35 X-Git-Url: https://git.tokkee.org/?p=sysdb.git;a=commitdiff_plain;h=ab6e6823b628af93e1f5d95ab1677e8843d913af client: Added sdb_client_shutdown(). --- diff --git a/src/client/sock.c b/src/client/sock.c index 805dc1d..b60bad4 100644 --- a/src/client/sock.c +++ b/src/client/sock.c @@ -211,6 +211,22 @@ sdb_client_sockfd(sdb_client_t *client) return client->fd; } /* sdb_client_sockfd */ +int +sdb_client_shutdown(sdb_client_t *client, int how) +{ + if (! client) { + errno = ENOTSOCK; + return -1; + } + + if (client->fd < 0) { + errno = EBADF; + return -1; + } + + return shutdown(client->fd, how); +} /* sdb_client_shutdown */ + void sdb_client_close(sdb_client_t *client) { diff --git a/src/include/client/sock.h b/src/include/client/sock.h index bce3da9..aeed8a2 100644 --- a/src/include/client/sock.h +++ b/src/include/client/sock.h @@ -83,6 +83,14 @@ sdb_client_connect(sdb_client_t *client, const char *username); int sdb_client_sockfd(sdb_client_t *client); +/* + * sdb_client_shutdown: + * Shut down the client's send and/or receive operations. + * See shutdown(3) for details. + */ +int +sdb_client_shutdown(sdb_client_t *client, int how); + /* * sdb_client_close: * Close the client connection.