提交 eea8be86 编写于 作者: P Peter Tyser 提交者: Wolfgang Denk

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: NPeter Tyser <ptyser@xes-inc.com>
上级 dbe29e36
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/socket.h>
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册