From a17985184ea8d4a1f01accba167c6ea207661469 Mon Sep 17 00:00:00 2001 From: mutantturkey Date: Thu, 26 Jul 2012 11:01:54 -0400 Subject: got rid of some build warnings, updated makefile --- Makefile | 10 +++++----- shttpd.c | 12 ++++++------ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 7c9c247..5b07846 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,13 @@ CC=cc -CFLAGS=-O2 -Wall +CFLAGS=-O2 -Wall -Wextra LIBS=`[ \`uname\` = "SunOS" ] && echo -lsocket -lnsl` TARGETS = bsd linux solaris .PHONY: all $(TARGETS) -all: darkhttpd +all: shttpd -darkhttpd: darkhttpd.c - $(CC) $(CFLAGS) $(LIBS) darkhttpd.c -o $@ +darkhttpd: shttpd.c + $(CC) $(CFLAGS) $(LIBS) shttpd.c -o $@ clean: - rm -f darkhttpd + rm -f shttpd diff --git a/shttpd.c b/shttpd.c index 9fc3b07..a1f623c 100644 --- a/shttpd.c +++ b/shttpd.c @@ -313,7 +313,7 @@ static void xclose(const int fd) { */ static void *xmalloc(const size_t size) { void *ptr = malloc(size); - if (ptr == NULL) errx(1, "can't allocate %u bytes", size); + if (ptr == NULL) errx(1, "can't allocate %lu bytes", size); return ptr; } @@ -323,7 +323,7 @@ static void *xmalloc(const size_t size) { */ static void *xrealloc(void *original, const size_t size) { void *ptr = realloc(original, size); - if (ptr == NULL) errx(1, "can't reallocate %u bytes", size); + if (ptr == NULL) errx(1, "can't reallocate %lu bytes", size); return ptr; } @@ -719,7 +719,7 @@ static char *read_line(FILE *fp) { if (fseek(fp, startpos, SEEK_SET) == -1) err(1, "fseek()"); numread = fread(buf, 1, linelen, fp); if (numread != linelen) - errx(1, "fread() %u bytes, expecting %u bytes", numread, linelen); + errx(1, "fread() %lu bytes, expecting %lu bytes", numread, linelen); /* terminate buffer */ buf[linelen] = 0; @@ -1610,7 +1610,7 @@ static void cleanup_sorted_dirlist(struct dlent **list, const ssize_t size) static int needs_urlencoding(unsigned char c) { int i; - const static char bad[] = "<>\"%{}|^~[]`\\;:/?@#=&"; + static const char bad[] = "<>\"%{}|^~[]`\\;:/?@#=&"; for (i=0; i