summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2022-07-07 11:23:02 +0100
committerIan Jackson <ijackson@chiark.greenend.org.uk>2022-07-07 11:24:23 +0100
commitbf6f956b4ebf81b866cd787c340e49cf413fb265 (patch)
treec94d64c8f58581eee9709238363380bb80b67bd0
parent7d324617084454f05cb6498299abb4abffdf3d49 (diff)
fix compile warnings/errors
-rw-r--r--__oop-read-copy.c2
-rw-r--r--cli.c2
-rw-r--r--conn.c4
-rw-r--r--debian/changelog6
-rw-r--r--duct.c2
-rw-r--r--innduct.h4
-rw-r--r--statemc.c8
7 files changed, 17 insertions, 11 deletions
diff --git a/__oop-read-copy.c b/__oop-read-copy.c
index 4fffdfc..bd505c4 100644
--- a/__oop-read-copy.c
+++ b/__oop-read-copy.c
@@ -404,7 +404,7 @@ static void *on_process(oop_source *oop, oop_read *rd, int try_read) {
}
assert(rd->style.nul_mode == OOP_RD_NUL_DISCARD);
for (notnul= nul+1;
- notnul < buf+thisrecsz && notnul == '\0';
+ notnul < buf+thisrecsz && *notnul == '\0';
notnul++);
thisrecsz-= (notnul-nul);
checked= nul-buf;
diff --git a/cli.c b/cli.c
index b4938f4..532f098 100644
--- a/cli.c
+++ b/cli.c
@@ -430,7 +430,7 @@ static void dumpinfo(const CliCommand *c, FILE *f) {
default:
abort();
}
- fprintf(f," #%03d %-11s l=%d %s\n", i, dinfo, iv->iov_len,
+ fprintf(f," #%03d %-11s l=%zd %s\n", i, dinfo, iv->iov_len,
sanitise(iv->iov_base, iv->iov_len));
free(dinfo);
}
diff --git a/conn.c b/conn.c
index 36f554f..9eee364 100644
--- a/conn.c
+++ b/conn.c
@@ -293,8 +293,8 @@ static void *connchild_event(oop_source *lp, int fd, oop_event e, void *u) {
#define CHK(field, val) \
if (h->cmsg_##field != val) { \
- crash("connect: child sent cmsg with cmsg_" #field "=%d, expected %d", \
- h->cmsg_##field, val); \
+ crash("connect: child sent cmsg with cmsg_" #field "=%ld, expected %ld", \
+ (long)h->cmsg_##field, (long)val); \
goto x; \
}
CHK(level, SOL_SOCKET);
diff --git a/debian/changelog b/debian/changelog
index eed138d..13c9abf 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+innduct (2.1~~iwj1) unstable; urgency=medium
+
+ * Fix many bugs and compiler warnings.
+
+ -- Ian Jackson <ijackson@chiark.greenend.org.uk> Thu, 07 Jul 2022 11:24:20 +0100
+
innduct (2.0~~iwj) unstable; urgency=medium
* Version 2.0 (builds against libinn2 1.5.4, has Debian build system).
diff --git a/duct.c b/duct.c
index 8f7af2c..29b8ea6 100644
--- a/duct.c
+++ b/duct.c
@@ -500,7 +500,7 @@ int main(int argc, char **argv) {
} else if (!path_cli[0] || !strcmp(path_cli,"none")) {
path_cli= 0; /* ok, don't then */
} else if (path_ends_slash(path_cli)) {
- path_cli_dir= masprintf("%.*s", strlen(path_cli)-1, path_cli);
+ path_cli_dir= masprintf("%.*s", (int)(strlen(path_cli)-1), path_cli);
}
if (path_cli_dir)
path_cli= masprintf("%s/%s", path_cli_dir, sitename);
diff --git a/innduct.h b/innduct.h
index 231524d..d82033a 100644
--- a/innduct.h
+++ b/innduct.h
@@ -322,7 +322,7 @@ void info(const char *fmt, ...) PRINTF(1,2);
void dbg(const char *fmt, ...) PRINTF(1,2);
void logv(int sysloglevel, const char *pfx, int errnoval,
- const char *fmt, va_list al) PRINTF(5,0);
+ const char *fmt, va_list al) PRINTF(4,0);
char *mvasprintf(const char *fmt, va_list al) PRINTF(1,0);
char *masprintf(const char *fmt, ...) PRINTF(1,2);
@@ -372,7 +372,7 @@ static inline int isewouldblock(int errnoval) {
INNLOGSET(debug, "debug", LOG_DEBUG)
#define INNLOGSET_DECLARE(fn, pfx, sysloglevel) \
void duct_log_##fn(int l, const char *fmt, va_list al, int errval) \
- PRINTF(3,0);
+ PRINTF(2,0);
INNLOGSETS(INNLOGSET_DECLARE)
/*----- duct.c -----*/
diff --git a/statemc.c b/statemc.c
index b068722..deeee36 100644
--- a/statemc.c
+++ b/statemc.c
@@ -105,7 +105,7 @@ void statemc_init(void) {
dbg("startup: ductdefer ENOENT");
} else {
dbg("startup: ductdefer nlink=%ld", (long)stabdefer.st_nlink);
- switch (stabdefer.st_nlink==1) {
+ switch (stabdefer.st_nlink) {
case 1:
open_defer(); /* so that we will later close it and rename it */
break;
@@ -114,8 +114,8 @@ void statemc_init(void) {
" (presumably hardlink to backlog file)");
break;
default:
- crash("defer file %s has unexpected link count %d",
- path_defer, stabdefer.st_nlink);
+ crash("defer file %s has unexpected link count %ld",
+ path_defer, (long)stabdefer.st_nlink);
}
}
@@ -521,7 +521,7 @@ void showstats(void) {
static int signal_self_pipe[2];
static void *sigarrived_event(oop_source *lp, int fd, oop_event e, void *u) {
- assert(fd=signal_self_pipe[0]);
+ assert(fd==signal_self_pipe[0]);
char buf[PIPE_BUF];
int r= read(signal_self_pipe[0], buf, sizeof(buf));
if (r<0 && !isewouldblock(errno))