Change type of talsz and dependent code from size_t to int. Tal ids are
authorclaudio <claudio@openbsd.org>
Tue, 19 Apr 2022 13:52:24 +0000 (13:52 +0000)
committerclaudio <claudio@openbsd.org>
Tue, 19 Apr 2022 13:52:24 +0000 (13:52 +0000)
already stored as int and and talsz is the limit for these ids.
OK tb@

usr.sbin/rpki-client/extern.h
usr.sbin/rpki-client/main.c
usr.sbin/rpki-client/output-json.c
usr.sbin/rpki-client/output.c

index a887d32..129e9b9 100644 (file)
@@ -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 <kristaps@bsd.lv>
  *
@@ -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. */
 
index 0f27e3d..05f7b72 100644 (file)
@@ -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 <claudio@openbsd.org>
  * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -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;
                                }
index 2703134..6b85893 100644 (file)
@@ -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 <claudio@openbsd.org>
  *
@@ -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);
index c455ebe..b23b3f8 100644 (file)
@@ -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 <deraadt@openbsd.org>
  *
@@ -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);