From: claudio Date: Mon, 10 May 2021 10:26:23 +0000 (+0000) Subject: Better way to detect the double new lines the API issues from time to time. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=1c7a6114d887a7b4772ad1e87fc55f5ed55c634c;p=openbsd Better way to detect the double new lines the API issues from time to time. This way done lines now will have a newline. --- diff --git a/regress/usr.sbin/bgpd/integrationtests/api-exabgp.c b/regress/usr.sbin/bgpd/integrationtests/api-exabgp.c index 559197706eb..d4f5426bdaa 100644 --- a/regress/usr.sbin/bgpd/integrationtests/api-exabgp.c +++ b/regress/usr.sbin/bgpd/integrationtests/api-exabgp.c @@ -72,7 +72,9 @@ main(int argc, char **argv) n = read(0, buf, sizeof(buf)); if (n == -1) err(1, "read stdin"); - if (write(2, buf, n - 1) != n - 1) + if (n > 2 && strncmp(buf + n - 2, "\n\n", 2) == 0) + n--; + if (write(2, buf, n) != n) errx(1, "bad write to stderr"); if (n > 8 && strncmp(buf, "shutdown", 8) == 0) errx(0, "exabgp shutdown");