while (*lines > 0) {
r = dprintf(fd, "LINE %d\n", *lines);
if (r < 0) {
- LOG_ERROR("Could not write line (%u) to stdin: %m\n", *lines);
-
- return 1;
+ switch (errno) {
+ case EAGAIN:
+ return 0;
+
+ default:
+ LOG_ERROR("Could not write line (%u) to stdin: %m\n", *lines);
+ return -errno;
+ }
}
// Decrement the lines counter