The while loop should be repeated, if the last write attempt was a partial write only. In this case, however, rc is greater than 0 (should be 1), not equal to 0.
ssize_t non_blocking_write(int fd, const void *buf, size_t count) {
void *ibuf = (void *)buf;
size_t bytes_remaining = count;
- int rc = 0;
+ int rc = 1;
struct pollfd ufds[1];
- while ((bytes_remaining > 0) && (rc == 0)) {
+ while ((bytes_remaining > 0) && (rc > 0)) {
// check that we can do some writing
ufds[0].fd = fd;
ufds[0].events = POLLOUT;