diff --git a/src/Makefile b/src/Makefile index f1d95b1..06e35b5 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,4 +1,4 @@ -CFLAGS = -Wall +CFLAGS = -Wall -Werror TARGETS = in.tokend pointscli claim.cgi puzzler.cgi puzzles.cgi all: build diff --git a/src/claim.cgi.c b/src/claim.cgi.c index ea767ff..d684da3 100644 --- a/src/claim.cgi.c +++ b/src/claim.cgi.c @@ -1,4 +1,5 @@ #include +#include #include "common.h" int diff --git a/src/common.c b/src/common.c index ca7afe0..878c447 100644 --- a/src/common.c +++ b/src/common.c @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -357,7 +358,6 @@ award_points(char const *teamhash, int linelen; char *filename; int fd; - int ret; time_t now = time(NULL); if (! team_exists(teamhash)) { @@ -365,8 +365,8 @@ award_points(char const *teamhash, } linelen = snprintf(line, sizeof(line), - "%u %s %s %ld\n", - now, teamhash, category, points); + "%lu %s %s %ld\n", + (unsigned long)now, teamhash, category, points); if (sizeof(line) <= linelen) { return -1; } @@ -428,7 +428,6 @@ award_and_log_uniquely(char const *team, char const *line) { char *dbpath = srv_path(dbfile); - int ret; int fd; /* Make sure they haven't already claimed these points */ diff --git a/src/common.h b/src/common.h index b5b4139..8488271 100644 --- a/src/common.h +++ b/src/common.h @@ -16,6 +16,7 @@ void cgi_error(char *fmt, ...); int fgrepx(char const *needle, char const *filename); +int my_snprintf(char *buf, size_t buflen, char *fmt, ...); char *srv_path(char const *fmt, ...); int team_exists(char const *teamhash); int award_points(char const *teamhacsh, diff --git a/src/in.tokend.c b/src/in.tokend.c index c043b78..2850610 100644 --- a/src/in.tokend.c +++ b/src/in.tokend.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include "common.h" #include "xxtea.h" @@ -117,7 +118,7 @@ main(int argc, char *argv[]) for (i = 0; i < itokenlen; i += 1) { crap[i] = (uint8_t)random(); } - bubblebabble(digest, crap, itokenlen); + bubblebabble(digest, (char *)crap, itokenlen); /* Append digest to service name. */ tokenlen = (size_t)my_snprintf(token, sizeof(token), diff --git a/src/puzzler.cgi.c b/src/puzzler.cgi.c index 3886a7d..235a110 100644 --- a/src/puzzler.cgi.c +++ b/src/puzzler.cgi.c @@ -1,4 +1,5 @@ #include +#include #include "common.h" int