X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=innduct.git;a=blobdiff_plain;f=innduct.c;h=5755855978910d14c31634706be020057b3e2a25;hp=445157da1527c16fe557d2da91b97ae65cf78ae6;hb=90d4051c0ca3db621c23331beb9c27ea51702948;hpb=f8e8b4f4647f437f8931663fcfb5efe711d98d5e diff --git a/innduct.c b/innduct.c index 445157d..5755855 100644 --- a/innduct.c +++ b/innduct.c @@ -594,7 +594,9 @@ static void logv(int sysloglevel, const char *pfx, int errnoval, va_end(al); \ } -#define INNLOGSET_DECLARE(fn, pfx, sysloglevel) \ +#define INNLOGSET_DECLARE(fn, pfx, sysloglevel) \ + static void duct_log_##fn(int l, const char *fmt, va_list al, int errval) \ + PRINTF(3,0); \ static void duct_log_##fn(int l, const char *fmt, va_list al, int errval) { \ logv(sysloglevel, pfx, errval ? errval : -1, fmt, al); \ } @@ -741,8 +743,8 @@ static void xgettimeofday(struct timeval *tv_r) { if (r) syscrash("gettimeofday(2) failed"); } -static void xsetnonblock(int fd, int nonblocking) { - int errnoval= oop_fd_nonblock(fd, nonblocking); +static void xsetnonblock(int fd, int nonb) { + int errnoval= oop_fd_nonblock(fd, nonb); if (errnoval) { errno= errnoval; syscrash("setnonblocking"); } } @@ -910,7 +912,7 @@ POKES("prod ", ccmd_setint_period) static void *cli_rd_ok(oop_source *lp, oop_read *oread, oop_rd_event ev, const char *errmsg, int errnoval, - const char *data, size_t recsz, void *cc_v) { + const char *data, size_t recszu, void *cc_v) { CliConn *cc= cc_v; if (!data) { @@ -919,7 +921,9 @@ static void *cli_rd_ok(oop_source *lp, oop_read *oread, oop_rd_event ev, return OOP_CONTINUE; } - if (recsz == 0) goto prompt; + if (recszu == 0) goto prompt; + assert(recszu <= INT_MAX); + int recsz= recszu; const CliCommand *ccmd; for (ccmd=cli_commands; ccmd->cmd; ccmd++) { @@ -1630,8 +1634,8 @@ static void inputfile_queue_check_expired(InputFile *ipf) { for (;;) { Article *art= LIST_HEAD(ipf->queue); - int exp= article_check_expired(art); - if (!exp) break; + int expd= article_check_expired(art); + if (!expd) break; } check_reading_pause_resume(ipf); } @@ -1737,7 +1741,8 @@ static void *conn_write_some_xmits(Conn *conn) { assert(donexmitu); struct iovec *vp= &conn->xmit[done]; XmitDetails *dp= &conn->xmitd[done]; - if (rs >= vp->iov_len) { + assert(vp->iov_len <= SSIZE_MAX); + if ((size_t)rs >= vp->iov_len) { rs -= vp->iov_len; xmit_free(dp); /* vp->iov_len -= vp->iov_len, etc. */ done++; @@ -1923,7 +1928,8 @@ static void article_done(Article *art, int whichcount) { " " " " " "; - int w= art->blanklen; if (w >= sizeof(spaces)) w= sizeof(spaces)-1; + int nspaces= sizeof(spaces)-1; + int w= art->blanklen; if (w > nspaces) w= nspaces; int r= pwrite(ipf->fd, spaces, w, art->offset); if (r==-1) { if (errno==EINTR) continue; @@ -2200,7 +2206,7 @@ static void *feedfile_got_article(oop_source *lp, oop_read *rd, /*========== tailing input file ==========*/ -static void *tailing_rable_call_time(oop_source *loop, struct timeval tv, +static void *tailing_rable_call_time(oop_source *lp, struct timeval tv, void *user) { /* lifetime of ipf here is OK because destruction will cause * on_cancel which will cancel this callback */ @@ -2951,7 +2957,8 @@ static void search_backlog_file(void) { /* returns non-0 iff there are any backlog files */ glob_t gl; - int r, i; + int r; + unsigned ui; struct stat stab; const char *oldest_path=0; time_t oldest_mtime=0, now; @@ -2968,8 +2975,8 @@ static void search_backlog_file(void) { case GLOB_NOSPACE: die("out of memory expanding backlog pattern %s", globpat_backlog); case 0: - for (i=0; ishrt || o->lng; o++) if (strlen(o->lng) == len && !memcmp(o->lng,arg,len)) goto found_long; @@ -3835,7 +3842,6 @@ int main(int argc, char **argv) { LIST_INIT(conns); if (interactive < 1) { - int i; for (i=3; i<255; i++) /* do this now before we open syslog, etc. */ close(i);