Merge pull request #294 from wltu/fix-unused-result

Fixed unused result issue with write()
This commit is contained in:
Yves Rutschle 2021-07-31 16:20:06 +02:00 committed by GitHub
commit 8e38d56167
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -81,7 +81,9 @@ void start_echo(int fd)
if (first) {
res = write(fd, buffer, ret + prefix_len);
first = 0;
write(1, buffer, ret + prefix_len);
if (write(1, buffer, ret + prefix_len) < 0) {
fprintf(stderr, "%s", strerror(errno));
}
} else {
res = write(fd, buffer + prefix_len, ret);
}