From: Michael D. Lowis Date: Wed, 17 Apr 2019 20:40:01 +0000 (-0400) Subject: fixed warnings and updated build script to support custom flags X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=c1a87d85a327d0081368e54be515beab5817405f;p=proto%2Fpick.git fixed warnings and updated build script to support custom flags --- diff --git a/build.sh b/build.sh index 319adf2..2bcd2c2 100755 --- a/build.sh +++ b/build.sh @@ -1,2 +1,4 @@ #!/bin/sh -gcc -D_XOPEN_SOURCE=700 *.c -I . -o pick -O3 -Wno-unused-result +name=pick +set -x +gcc $CFLAGS -D_XOPEN_SOURCE=700 -I. -o $name *.c $LDFLAGS diff --git a/bytebuffer.inl b/bytebuffer.inl index c476742..b24a67f 100644 --- a/bytebuffer.inl +++ b/bytebuffer.inl @@ -63,7 +63,7 @@ static void bytebuffer_resize(struct bytebuffer *b, int len) { } static void bytebuffer_flush(struct bytebuffer *b, int fd) { - write(fd, b->buf, b->len); + if (write(fd, b->buf, b->len) < 0) { /* oh well */ } bytebuffer_clear(b); } diff --git a/termbox.c b/termbox.c index 71257f7..a6b9366 100644 --- a/termbox.c +++ b/termbox.c @@ -582,7 +582,7 @@ static void sigwinch_handler(int xxx) { (void) xxx; const int zzz = 1; - write(winch_fds[1], &zzz, sizeof(int)); + if (write(winch_fds[1], &zzz, sizeof(int)) < 0) { /* oh well */ } } static void update_size(void) @@ -672,7 +672,7 @@ static int wait_fill_event(struct tb_event *event, struct timeval *timeout) if (FD_ISSET(winch_fds[0], &events)) { event->type = TB_EVENT_RESIZE; int zzz = 0; - read(winch_fds[0], &zzz, sizeof(int)); + if (read(winch_fds[0], &zzz, sizeof(int)) < 0) { /* oh well */ } buffer_size_change_request = 1; get_term_size(&event->w, &event->h); return TB_EVENT_RESIZE;