From e63488b5a2430e99da070ab43e0bd83702bd8679 Mon Sep 17 00:00:00 2001 From: Andrew Pamment Date: Thu, 31 May 2018 21:25:07 +1000 Subject: [PATCH] attempt to fix too many openfiles --- utils/mnetftpd/mnetftpd.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/utils/mnetftpd/mnetftpd.c b/utils/mnetftpd/mnetftpd.c index 79dea2f..d37a677 100644 --- a/utils/mnetftpd/mnetftpd.c +++ b/utils/mnetftpd/mnetftpd.c @@ -391,9 +391,7 @@ void handle_STOR(struct ftpserver *cfg, struct ftpclient *client, char *path) { } else if (pid < 0) { send_msg(client, "451 STOR Failed.\r\n"); } else { - client->data_socket = -1; - memset(client->data_ip, 0, INET6_ADDRSTRLEN); - client->data_srv_socket = -1; + close_tcp_connection(client); } } else { send_msg(client, "553 File Exists.\n"); @@ -600,10 +598,7 @@ void handle_RETR(struct ftpserver *cfg, struct ftpclient *client, char *file) { if (pid > 0) { // nothing - client->data_socket = -1; - memset(client->data_ip, 0, INET6_ADDRSTRLEN); - client->data_srv_socket = -1; - + close_tcp_connection(client); } else if (pid == 0) { if (stat(fullpath, &s) == 0) {