From 389eb2093e71ff338ec62c92ac1dcf20e76c4574 Mon Sep 17 00:00:00 2001 From: claudio Date: Tue, 19 Apr 2022 13:52:24 +0000 Subject: [PATCH] Change type of talsz and dependent code from size_t to int. Tal ids are already stored as int and and talsz is the limit for these ids. OK tb@ --- usr.sbin/rpki-client/extern.h | 4 ++-- usr.sbin/rpki-client/main.c | 17 ++++++++--------- usr.sbin/rpki-client/output-json.c | 4 ++-- usr.sbin/rpki-client/output.c | 4 ++-- 4 files changed, 14 insertions(+), 15 deletions(-) diff --git a/usr.sbin/rpki-client/extern.h b/usr.sbin/rpki-client/extern.h index a887d320b48..129e9b9f91f 100644 --- a/usr.sbin/rpki-client/extern.h +++ b/usr.sbin/rpki-client/extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: extern.h,v 1.127 2022/04/19 09:52:29 claudio Exp $ */ +/* $OpenBSD: extern.h,v 1.128 2022/04/19 13:52:24 claudio Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons * @@ -414,7 +414,7 @@ extern int filemode; extern const char *tals[]; extern const char *taldescs[]; extern unsigned int talrepocnt[]; -extern size_t talsz; +extern int talsz; /* Routines for RPKI entities. */ diff --git a/usr.sbin/rpki-client/main.c b/usr.sbin/rpki-client/main.c index 0f27e3df6a1..05f7b729ecc 100644 --- a/usr.sbin/rpki-client/main.c +++ b/usr.sbin/rpki-client/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.195 2022/04/19 11:07:33 claudio Exp $ */ +/* $OpenBSD: main.c,v 1.196 2022/04/19 13:52:24 claudio Exp $ */ /* * Copyright (c) 2021 Claudio Jeker * Copyright (c) 2019 Kristaps Dzonsons @@ -47,7 +47,7 @@ const char *tals[TALSZ_MAX]; const char *taldescs[TALSZ_MAX]; unsigned int talrepocnt[TALSZ_MAX]; -size_t talsz; +int talsz; size_t entity_queue; int timeout = 60*60; @@ -620,11 +620,11 @@ rrdp_process(struct ibuf *b) * This may be zero. * Don't exceded "max" filenames. */ -static size_t +static int tal_load_default(void) { static const char *confdir = "/etc/rpki"; - size_t s = 0; + int s = 0; char *path; DIR *dirp; struct dirent *dp; @@ -711,8 +711,7 @@ suicide(int sig __attribute__((unused))) int main(int argc, char *argv[]) { - int rc, c, st, proc, rsync, http, rrdp, hangup = 0; - size_t i; + int rc, c, i, st, proc, rsync, http, rrdp, hangup = 0; pid_t pid, procpid, rsyncpid, httppid, rrdppid; struct pollfd pfd[NPFD]; struct msgbuf *queues[NPFD]; @@ -1003,7 +1002,7 @@ main(int argc, char *argv[]) for (i = 0; i < NPFD; i++) { if (pfd[i].revents & (POLLERR|POLLNVAL)) { - warnx("poll[%zu]: bad fd", i); + warnx("poll[%d]: bad fd", i); hangup = 1; } if (pfd[i].revents & POLLHUP) @@ -1011,12 +1010,12 @@ main(int argc, char *argv[]) if (pfd[i].revents & POLLOUT) { switch (msgbuf_write(queues[i])) { case 0: - warnx("write[%zu]: " + warnx("write[%d]: " "connection closed", i); hangup = 1; break; case -1: - warn("write[%zu]", i); + warn("write[%d]", i); hangup = 1; break; } diff --git a/usr.sbin/rpki-client/output-json.c b/usr.sbin/rpki-client/output-json.c index 2703134a097..6b85893b665 100644 --- a/usr.sbin/rpki-client/output-json.c +++ b/usr.sbin/rpki-client/output-json.c @@ -1,4 +1,4 @@ -/* $OpenBSD: output-json.c,v 1.23 2022/01/14 15:00:23 claudio Exp $ */ +/* $OpenBSD: output-json.c,v 1.24 2022/04/19 13:52:24 claudio Exp $ */ /* * Copyright (c) 2019 Claudio Jeker * @@ -28,7 +28,7 @@ outputheader_json(FILE *out, struct stats *st) char hn[NI_MAXHOST], tbuf[26]; struct tm *tp; time_t t; - size_t i; + int i; time(&t); setenv("TZ", "UTC", 1); diff --git a/usr.sbin/rpki-client/output.c b/usr.sbin/rpki-client/output.c index c455ebec437..b23b3f8066d 100644 --- a/usr.sbin/rpki-client/output.c +++ b/usr.sbin/rpki-client/output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: output.c,v 1.24 2021/11/04 11:32:55 claudio Exp $ */ +/* $OpenBSD: output.c,v 1.25 2022/04/19 13:52:24 claudio Exp $ */ /* * Copyright (c) 2019 Theo de Raadt * @@ -201,7 +201,7 @@ outputheader(FILE *out, struct stats *st) char hn[NI_MAXHOST], tbuf[80]; struct tm *tp; time_t t; - size_t i; + int i; time(&t); setenv("TZ", "UTC", 1); -- 2.20.1