Gracefully close the socket
authorJoseph C. Lehner <joseph.c.lehner@gmail.com>
Fri, 5 Feb 2016 12:16:49 +0000 (14:16 +0200)
committerJoseph C. Lehner <joseph.c.lehner@gmail.com>
Fri, 5 Feb 2016 12:22:56 +0000 (14:22 +0200)
tftp.c

diff --git a/tftp.c b/tftp.c
index 5a09aa2dbdcd89d5101763fa57a71d357d840d78..80efff0c090839d532c23f35071bce467709c7e8 100644 (file)
--- 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;