From: Joseph C. Lehner Date: Fri, 5 Feb 2016 12:16:49 +0000 (+0200) Subject: Gracefully close the socket X-Git-Tag: v0.9~49 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=ea850215ab4b13de504dcd765c95eb67b6be8ff7;p=oweals%2Fnmrpflash.git Gracefully close the socket --- diff --git a/tftp.c b/tftp.c index 5a09aa2..80efff0 100644 --- a/tftp.c +++ b/tftp.c @@ -314,7 +314,12 @@ cleanup: } if (sock >= 0) { + shutdown(sock, SHUT_RDWR); +#ifndef NMRPFLASH_WINDOWS close(sock); +#else + closesocket(sock); +#endif } return err;