From 1a0c41a04e82938da86868ebe03883a323d8e4e0 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Tue, 2 Jan 2024 13:07:33 -0500 Subject: [PATCH] Remove sock_close and sock_shutdown 'portability' defs. --- citadel/server/clientsocket.c | 2 +- citadel/server/clientsocket.h | 22 ++++------------------ citadel/server/modules/spam/serv_spam.c | 5 +++-- 3 files changed, 8 insertions(+), 21 deletions(-) diff --git a/citadel/server/clientsocket.c b/citadel/server/clientsocket.c index 78e5be9c1..c3ce905b5 100644 --- a/citadel/server/clientsocket.c +++ b/citadel/server/clientsocket.c @@ -182,7 +182,7 @@ int sock_write_timeout(int *sock, const char *buf, int nbytes, int timeout) { retval = write(*sock, &buf[bytes_written], nbytes - bytes_written); if (retval < 1) { - sock_close(*sock); + close(*sock); *sock = -1; return (-1); } diff --git a/citadel/server/clientsocket.h b/citadel/server/clientsocket.h index cc275e1a5..0fe45fa3e 100644 --- a/citadel/server/clientsocket.h +++ b/citadel/server/clientsocket.h @@ -1,14 +1,9 @@ // Header file for TCP client socket library // -// Copyright (c) 1987-2012 by the citadel.org team +// Copyright (c) 1987-2024 by the citadel.org team // -// This program is open source software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License version 3. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. +// This program is open source software. Use, duplication, or disclosure +// is subject to the terms of the GNU General Public License version 3. int sock_connect(char *host, char *service); int sock_write(int *sock, const char *buf, int nbytes); @@ -19,14 +14,5 @@ int CtdlSockGetLine(int *sock, StrBuf *Target, int nSec); int sock_puts(int *sock, char *buf); int socket_read_blob(int *Socket, StrBuf * Target, int bytes, int timeout); - -/* - * This looks dumb, but it's being done for future portability - */ -#define sock_close(sock) close(sock) -#define sock_shutdown(sock, how) shutdown(sock, how) - -/* - * Default timeout for client sessions - */ +// Default timeout for client sessions #define CLIENT_TIMEOUT 600 diff --git a/citadel/server/modules/spam/serv_spam.c b/citadel/server/modules/spam/serv_spam.c index 88e0a4b3e..863bd0020 100644 --- a/citadel/server/modules/spam/serv_spam.c +++ b/citadel/server/modules/spam/serv_spam.c @@ -87,8 +87,9 @@ int spam_assassin(struct CtdlMessage *msg, struct recptypes *recp) { FreeStrBuf(&msgtext); // Close one end of the socket connection; this tells SpamAssassin that we're done. - if (sock != -1) - sock_shutdown(sock, SHUT_WR); + if (sock != -1) { + shutdown(sock, SHUT_WR); + } // Response syslog(LOG_DEBUG, "Awaiting response\n"); -- 2.30.2