Skip to content

Commit

Permalink
ncb: Check return value of write()
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Peter Tyser authored and wdenx committed Apr 27, 2009
1 parent dbe29e3 commit eea8be8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tools/ncb.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/socket.h>
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit eea8be8

Please sign in to comment.