void-packages/srcpkgs/libfetch/patches/use-ssl-pending.patch
Đoàn Trần Công Danh 861ac185a6 srcpkgs/l*: convert patches to -Np1
```sh
git grep -l '^patch_args=-Np0' "srcpkgs/$1*/template" |
while read template; do
	for p in ${template%/template}/patches/*; do
		sed -i '
			\,^[+-][+-][+-] /dev/null,b
			/^[*-]\+ [0-9]\+\(,[0-9]\+\)\? [*-]\+$/b
			s,^[*][*][*] ,&a/,
			/^--- /{
				s,\(^--- \)\(./\)*,\1a/,
				s,[.][Oo][Rr][Ii][Gg]\([	/]\),\1,
				s/[.][Oo][Rr][Ii][Gg]$//
				s/[.]patched[.]\([^.]\)/.\1/
				h
			}
			/^+++ -/{
				g
				s/^--- a/+++ b/
				b
			}
			s,\(^+++ \)\(./\)*,\1b/,
		' "$p"
	done
	sed -i '/^patch_args=/d' $template
done
```
2021-06-20 13:17:29 +07:00

18 lines
573 B
Diff

select() times out if there's no IO ready in the socket which sometimes
might happen due to OpenSSL buffering.
Use SSL_pending(3) to make sure SSL_read(3) sucks in last buffered bytes.
--- a/common.c 2013-01-13 17:12:06.434631196 +0100
+++ b/common.c 2013-01-13 17:12:36.185921621 +0100
@@ -529,6 +529,10 @@ fetch_read(conn_t *conn, char *buf, size
fetch_syserr();
return (-1);
}
+#ifdef WITH_SSL
+ if (conn->ssl && SSL_pending(conn->ssl))
+ break;
+#endif
errno = 0;
r = select(conn->sd + 1, &readfds, NULL, NULL, &waittv);
if (r == -1) {