1 /* Read LEN bytes at PTR from descriptor DESC, retrying if necessary.
2 Return the actual number of bytes read, zero for EOF, or negative
6 safe_read (desc, ptr, len)
14 while (n_remaining > 0)
16 int n_chars = read (desc, ptr, n_remaining);
28 n_remaining -= n_chars;
30 return len - n_remaining;