From 6a37494ece4f0d6310641af1d5f258ea1ea61b31 Mon Sep 17 00:00:00 2001 From: tb Date: Mon, 22 Nov 2021 08:26:08 +0000 Subject: [PATCH] acme-client: use BIO_number_written(bio) instead of bio->num_write. Avoid awkward line wrapping by removing awkward else if chaining. ok claudio florian --- usr.sbin/acme-client/revokeproc.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/usr.sbin/acme-client/revokeproc.c b/usr.sbin/acme-client/revokeproc.c index 9280b2c334f..3eb0bd4cafa 100644 --- a/usr.sbin/acme-client/revokeproc.c +++ b/usr.sbin/acme-client/revokeproc.c @@ -1,4 +1,4 @@ -/* $Id: revokeproc.c,v 1.18 2021/10/13 18:09:42 tb Exp $ */ +/* $Id: revokeproc.c,v 1.19 2021/11/22 08:26:08 tb Exp $ */ /* * Copyright (c) 2016 Kristaps Dzonsons * @@ -186,15 +186,17 @@ revokeproc(int fd, const char *certfile, int force, if (bio == NULL) { warnx("BIO_new"); goto out; - } else if (!X509V3_EXT_print(bio, ex, 0, 0)) { + } + if (!X509V3_EXT_print(bio, ex, 0, 0)) { warnx("X509V3_EXT_print"); goto out; - } else if ((san = calloc(1, bio->num_write + 1)) == NULL) { + } + if ((san = calloc(1, BIO_number_written(bio) + 1)) == NULL) { warn("calloc"); goto out; } - ssz = BIO_read(bio, san, bio->num_write); - if (ssz < 0 || (unsigned)ssz != bio->num_write) { + ssz = BIO_read(bio, san, BIO_number_written(bio)); + if (ssz < 0 || (unsigned)ssz != BIO_number_written(bio)) { warnx("BIO_read"); goto out; } -- 2.20.1