getting an EOF they get an EIO, which strikes me as unfriendly. So
make sure we exit the main read loop without complaint on an EOF or
error.
if (cc > 0 && FD_ISSET(master, &readfds)) {
cc = read(master, readbuf, sizeof(readbuf));
if (cc > 0 && FD_ISSET(master, &readfds)) {
cc = read(master, readbuf, sizeof(readbuf));
- if (cc < 0) {
- fprintf(stderr, "read() failed: %s\n", strerror(errno));
- exit(1);
- }
-
- if (cc == 0)
break;
fwrite(readbuf, 1, cc, output);
break;
fwrite(readbuf, 1, cc, output);