diff --git a/utils/magiftpd/magiftpd.c b/utils/magiftpd/magiftpd.c index 4789c4a..d2bb732 100644 --- a/utils/magiftpd/magiftpd.c +++ b/utils/magiftpd/magiftpd.c @@ -355,9 +355,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"); @@ -522,9 +520,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) { @@ -573,9 +569,7 @@ void handle_LIST(struct ftpserver *cfg, struct ftpclient *client) { 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) { dirp = opendir(newpath); diff --git a/utils/mnetftpd/mnetftpd.c b/utils/mnetftpd/mnetftpd.c index d37a677..f532857 100644 --- a/utils/mnetftpd/mnetftpd.c +++ b/utils/mnetftpd/mnetftpd.c @@ -645,9 +645,7 @@ void handle_LIST(struct ftpserver *cfg, struct ftpclient *client) { 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 (client->current_path == NULL) { if (!open_tcp_connection(cfg, client)) {