Description: Fix PPTP connections drop Origin: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=692129#22 Author: Maximiliano Curia Forwarded: http://sourceforge.net/mailarchive/forum.php?thread_name=1360193901%40msgid.manchmal.in-ulm.de&forum_name=poptop-server Bug-Debian: http://bugs.debian.org/692129 --- a/pptpgre.c +++ b/pptpgre.c @@ -443,6 +443,7 @@ unsigned char buffer[PACKET_MAX + sizeof(struct pptp_gre_header)]; } u; unsigned header_len; + ssize_t status; #ifdef HAVE_WRITEV struct iovec iovec[2]; #endif @@ -493,12 +494,18 @@ iovec[0].iov_len = header_len; iovec[1].iov_base = pack; iovec[1].iov_len = len; - return writev(fd, iovec, 2); + status = writev(fd, iovec, 2); #else /* copy payload into buffer */ memcpy(u.buffer + header_len, pack, len); /* record and increment sequence numbers */ /* write this baby out to the net */ - return write(fd, u.buffer, header_len + len); + status = write(fd, u.buffer, header_len + len); #endif + if ((status >= 0) || (errno != ENOBUFS)) { + return status; + } + // if ENOBUFS, do not close the connection + gre.seq_sent--; + return 0; }