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); \
}
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"); }
}
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) {
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++) {
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);
}
assert(done<conn->xmitu);
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++;
" "
" "
" ";
- 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;
/*========== 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 */
/* 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;
case GLOB_NOSPACE:
die("out of memory expanding backlog pattern %s", globpat_backlog);
case 0:
- for (i=0; i<gl.gl_pathc; i++) {
- const char *path= gl.gl_pathv[i];
+ for (ui=0; ui<gl.gl_pathc; ui++) {
+ const char *path= gl.gl_pathv[ui];
if (strchr(path,'#') || strchr(path,'~')) {
dbg("backlog file search skipping %s", path);
preterminate();
notice("feed dropped and our work is complete");
- int r= unlink(path_cli);
+ r= unlink(path_cli);
if (r && errno!=ENOENT)
syswarn("failed to unlink cli socket for old feed");
if (a=='-') {
arg++;
char *equals= strchr(arg,'=');
- int len= equals ? (equals - arg) : strlen(arg);
+ unsigned len= equals ? (size_t)(equals - arg) : strlen(arg);
for (o=options; o->shrt || o->lng; o++)
if (strlen(o->lng) == len && !memcmp(o->lng,arg,len))
goto found_long;
LIST_INIT(conns);
if (interactive < 1) {
- int i;
for (i=3; i<255; i++)
/* do this now before we open syslog, etc. */
close(i);