From: Peter Tyser Date: Fri, 24 Apr 2009 20:59:46 +0000 (-0500) Subject: ncb: Check return value of write() X-Git-Tag: v2009.06-rc1~14 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=eea8be86d1c2b570660d1f6c553845e13164231a;p=oweals%2Fu-boot.git ncb: Check return value of write() This prevents the compilation warning: ncb.c: In function 'main': ncb.c:32: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result Signed-off-by: Peter Tyser --- diff --git a/tools/ncb.c b/tools/ncb.c index 30acbead5f..ec8d8a7435 100644 --- a/tools/ncb.c +++ b/tools/ncb.c @@ -1,3 +1,4 @@ +#include #include #include #include @@ -29,7 +30,8 @@ int main (int argc, char *argv[]) len = recvfrom (s, buf, sizeof buf, 0, (struct sockaddr *) &addr, &addr_len); if (len < 0) break; - write (1, buf, len); + if (write (1, buf, len) != len) + fprintf(stderr, "WARNING: serial characters dropped\n"); } return 0;