From: tb Date: Mon, 10 Jul 2023 02:33:33 +0000 (+0000) Subject: BIO_indent: use %*s rather than puts in a loop X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=33d8540c847cab96afb52bd048ee6ab378530074;p=openbsd BIO_indent: use %*s rather than puts in a loop ok beck jsing millert --- diff --git a/lib/libcrypto/bio/bio_lib.c b/lib/libcrypto/bio/bio_lib.c index 3dd5e17ed30..c0a74ee29b3 100644 --- a/lib/libcrypto/bio/bio_lib.c +++ b/lib/libcrypto/bio/bio_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bio_lib.c,v 1.46 2023/07/07 19:37:53 beck Exp $ */ +/* $OpenBSD: bio_lib.c,v 1.47 2023/07/10 02:33:33 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -548,11 +548,10 @@ BIO_indent(BIO *b, int indent, int max) { if (indent > max) indent = max; - if (indent < 0) - indent = 0; - while (indent--) - if (BIO_puts(b, " ") != 1) - return 0; + if (indent <= 0) + return 1; + if (BIO_printf(b, "%*s", indent, "") <= 0) + return 0; return 1; } LCRYPTO_ALIAS(BIO_indent);