summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2024-11-22 07:16:13 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2024-11-22 07:16:13 +0000
commite40f553f883f7388240d4718a2f15ef42950b958 (patch)
tree35d825045c991f333e03a27b4b54e298906fec36
parent3cdbdc38347d134c6080bd53a60ee681dcf67f63 (diff)
Adjust test-http.c to the new ibuf world order.
Failure noticed by anton@
-rw-r--r--regress/usr.sbin/rpki-client/test-http.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/regress/usr.sbin/rpki-client/test-http.c b/regress/usr.sbin/rpki-client/test-http.c
index 4052c809561..3ab3742f7fb 100644
--- a/regress/usr.sbin/rpki-client/test-http.c
+++ b/regress/usr.sbin/rpki-client/test-http.c
@@ -87,13 +87,21 @@ http_result(enum http_result res)
static int
http_response(int fd)
{
- struct ibuf *b, *httpbuf = NULL;
+ struct ibuf *b;
unsigned int id;
enum http_result res;
char *lastmod;
- while ((b = io_buf_read(fd, &httpbuf)) == NULL)
- /* nothing */ ;
+ while (1) {
+ switch (msgbuf_read(fd, httpq)) {
+ case -1:
+ err(1, "msgbuf_read");
+ case 0:
+ errx(1, "msgbuf_read: connection closed");
+ }
+ if ((b = io_buf_get(httpq)) != NULL)
+ break;
+ }
io_read_buf(b, &id, sizeof(id));
io_read_buf(b, &res, sizeof(res));
@@ -142,7 +150,8 @@ main(int argc, char **argv)
close(fd[0]);
httpfd = fd[1];
- if ((httpq = msgbuf_new()) == NULL)
+ if ((httpq = msgbuf_new_reader(sizeof(size_t), io_parse_hdr, NULL)) ==
+ NULL)
err(1, NULL);
if ((outfd = open(file, O_WRONLY|O_CREAT|O_TRUNC, 0666)) == -1)