diff options
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | tailburst.c | 11 |
2 files changed, 7 insertions, 6 deletions
@@ -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 }; |