summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominique Martinet <asmadeus@codewreck.org>2017-02-12 10:13:44 +0100
committerDominique Martinet <asmadeus@codewreck.org>2017-02-12 10:13:44 +0100
commitcb500e603daa4bbd11762fc96c51319d3bfd9255 (patch)
tree70de0cf6149871a057fbdddf9f57463e246ed33b
parentec9f67cff5eac2e3a15d997ccb67b459f77f5427 (diff)
add -Wall
-rw-r--r--Makefile2
-rw-r--r--tailburst.c11
2 files changed, 7 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index 921e931..beeae74 100644
--- a/Makefile
+++ b/Makefile
@@ -2,6 +2,8 @@ SOURCES=tailburst.c
OBJECTS=$(SOURCES:.c=.o)
MAIN=tailburst
+CFLAGS+=-Wall -Werror
+
all: $(MAIN)
$(MAIN): $(OBJECTS)
diff --git a/tailburst.c b/tailburst.c
index 2aaa5a5..634dc92 100644
--- a/tailburst.c
+++ b/tailburst.c
@@ -40,7 +40,7 @@ ssize_t fdgetline(int fd, struct getline_states *line) {
line->cur = line->base;
/* Do we already have a full line in buffer? */
- if (str = strchr(line->cur, '\n')) {
+ if ((str = strchr(line->cur, '\n'))) {
line->next = str+1;
str[0] = '\0';
pr_debug("next already buffered, %p %p: %s\n", str, line->cur, line->cur);
@@ -56,11 +56,11 @@ ssize_t fdgetline(int fd, struct getline_states *line) {
}
while ((nread = read(fd, line->base + line->read, line->size - line->read)) > 0 ) {
- pr_debug("read %d\n", nread);
+ pr_debug("read %zd\n", nread);
line->read += nread;
/* Check if we have a full line now */
- if (str = strchr(line->base, '\n')) {
+ if ((str = strchr(line->base, '\n'))) {
line->next = str+1;
str[0] = '\0';
pr_debug("found stuff, %p %p %p: %s\n", str, line->base, line->cur, line->cur);
@@ -73,7 +73,7 @@ ssize_t fdgetline(int fd, struct getline_states *line) {
if (line->base == NULL)
return -ENOMEM;
}
- pr_debug("got here? %d %d\n", nread, errno);
+ pr_debug("got here? %zd %d\n", nread, errno);
line->next = line->cur;
if (errno)
@@ -85,8 +85,7 @@ ssize_t fdgetline(int fd, struct getline_states *line) {
int main(int argc, char **argv)
{
- int flags, fd = 0, rc;
- size_t len = 0;
+ int flags, fd = 0;
ssize_t nread;
struct pollfd pollfd;
struct getline_states line = { 0 };