summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2021-03-29 03:45:35 +0000
committerderaadt <deraadt@openbsd.org>2021-03-29 03:45:35 +0000
commit3a8a5c8a07d116307250eea931efafb02452a2b7 (patch)
treee18a98718574d3808be81246fef9414d8eda5216 /usr.sbin
parentimprove the naming of some intermediate buffers (diff)
downloadwireguard-openbsd-3a8a5c8a07d116307250eea931efafb02452a2b7.tar.xz
wireguard-openbsd-3a8a5c8a07d116307250eea931efafb02452a2b7.zip
minor KNF and consistancy
(rpki-client is pretty good code, couple hours of audit and I can only find a few minor things)
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/rpki-client/main.c8
-rw-r--r--usr.sbin/rpki-client/mkdir.c7
-rw-r--r--usr.sbin/rpki-client/x509.c5
3 files changed, 12 insertions, 8 deletions
diff --git a/usr.sbin/rpki-client/main.c b/usr.sbin/rpki-client/main.c
index 74ed9b44057..35f0956debd 100644
--- a/usr.sbin/rpki-client/main.c
+++ b/usr.sbin/rpki-client/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.125 2021/03/26 16:03:29 claudio Exp $ */
+/* $OpenBSD: main.c,v 1.126 2021/03/29 03:45:35 deraadt Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -302,13 +302,13 @@ http_ta_fetch(struct repo *rp)
int filefd;
rp->temp = ta_filename(rp, 1);
-
+
filefd = mkostemp(rp->temp, O_CLOEXEC);
if (filefd == -1)
err(1, "mkostemp: %s", rp->temp);
if (fchmod(filefd, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH) == -1)
warn("fchmod: %s", rp->temp);
-
+
if ((b = ibuf_dynamic(256, UINT_MAX)) == NULL)
err(1, NULL);
io_simple_buffer(b, &rp->id, sizeof(rp->id));
@@ -750,7 +750,7 @@ tal_load_default(const char *tals[], size_t max)
tals[s++] = path;
}
closedir (dirp);
- return (s);
+ return s;
}
static char **
diff --git a/usr.sbin/rpki-client/mkdir.c b/usr.sbin/rpki-client/mkdir.c
index 228b7e3a0f9..7c6d66684ac 100644
--- a/usr.sbin/rpki-client/mkdir.c
+++ b/usr.sbin/rpki-client/mkdir.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mkdir.c,v 1.4 2021/03/02 09:23:59 claudio Exp $ */
+/* $OpenBSD: mkdir.c,v 1.5 2021/03/29 03:45:35 deraadt Exp $ */
/*
* Copyright (c) 1983, 1992, 1993
@@ -33,6 +33,7 @@
#include <errno.h>
#include <string.h>
+#include <stdlib.h>
#include "extern.h"
@@ -61,7 +62,7 @@ mkpath(const char *dir)
if (mkdir(path, 0755) == -1 && errno != EEXIST) {
free(path);
- return (-1);
+ return -1;
}
if (done)
@@ -71,5 +72,5 @@ mkpath(const char *dir)
}
free(path);
- return (0);
+ return 0;
}
diff --git a/usr.sbin/rpki-client/x509.c b/usr.sbin/rpki-client/x509.c
index 85fdd24a8d6..0457c55dd68 100644
--- a/usr.sbin/rpki-client/x509.c
+++ b/usr.sbin/rpki-client/x509.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: x509.c,v 1.16 2021/02/18 16:23:17 claudio Exp $ */
+/* $OpenBSD: x509.c,v 1.17 2021/03/29 03:45:35 deraadt Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -85,6 +85,7 @@ x509_get_aki(X509 *x, int ta, const char *fn)
if ((res = calloc(dsz * 3 + 1, 1)) == NULL)
err(1, NULL);
+// XXX hate this
for (i = 0; i < dsz; i++) {
snprintf(buf, sizeof(buf), "%02X:", d[i]);
strlcat(res, buf, dsz * 3 + 1);
@@ -135,6 +136,7 @@ x509_get_ski(X509 *x, const char *fn)
if ((res = calloc(dsz * 3 + 1, 1)) == NULL)
err(1, NULL);
+// XXX hate this
for (i = 0; i < dsz; i++) {
snprintf(buf, sizeof(buf), "%02X:", d[i]);
strlcat(res, buf, dsz * 3 + 1);
@@ -347,6 +349,7 @@ x509_crl_get_aki(X509_CRL *crl, const char *fn)
if ((res = calloc(dsz * 3 + 1, 1)) == NULL)
err(1, NULL);
+// XXX hate this
for (i = 0; i < dsz; i++) {
snprintf(buf, sizeof(buf), "%02X:", d[i]);
strlcat(res, buf, dsz * 3 + 1);