The code uses int for talid so there is no reason to use a size_t for the
talsz (which is the maximum talid). I also switched the type of i in
main.c to int which is used in for loops around talsz but also for NFDS.
Adjust the code in the output functions as well.

-- 
:wq Claudio

Index: extern.h
===================================================================
RCS file: /cvs/src/usr.sbin/rpki-client/extern.h,v
retrieving revision 1.127
diff -u -p -r1.127 extern.h
--- extern.h    19 Apr 2022 09:52:29 -0000      1.127
+++ extern.h    19 Apr 2022 10:58:02 -0000
@@ -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: main.c
===================================================================
RCS file: /cvs/src/usr.sbin/rpki-client/main.c,v
retrieving revision 1.194
diff -u -p -r1.194 main.c
--- main.c      19 Apr 2022 09:52:29 -0000      1.194
+++ main.c      19 Apr 2022 12:49:58 -0000
@@ -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;
@@ -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: output-json.c
===================================================================
RCS file: /cvs/src/usr.sbin/rpki-client/output-json.c,v
retrieving revision 1.23
diff -u -p -r1.23 output-json.c
--- output-json.c       14 Jan 2022 15:00:23 -0000      1.23
+++ output-json.c       19 Apr 2022 10:59:44 -0000
@@ -28,7 +28,7 @@ outputheader_json(FILE *out, struct stat
        char            hn[NI_MAXHOST], tbuf[26];
        struct tm       *tp;
        time_t          t;
-       size_t          i;
+       int             i;
 
        time(&t);
        setenv("TZ", "UTC", 1);
Index: output.c
===================================================================
RCS file: /cvs/src/usr.sbin/rpki-client/output.c,v
retrieving revision 1.24
diff -u -p -r1.24 output.c
--- output.c    4 Nov 2021 11:32:55 -0000       1.24
+++ output.c    19 Apr 2022 10:59:40 -0000
@@ -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);

Reply via email to