MCPcopy Index your code
hub / github.com/RsyncProject/rsync / safe_read

Function safe_read

util1.c:308–320  ·  view source on GitHub ↗

* Read @p len bytes at @p ptr from descriptor @p desc, retrying if * interrupted. * * @retval >0 the actual number of bytes read * * @retval 0 for EOF * * @retval <0 for an error. * * Derived from GNU C's cccp.c. */

Source from the content-addressed store, hash-verified

306 *
307 * Derived from GNU C's cccp.c. */
308static int safe_read(int desc, char *ptr, size_t len)
309{
310 int n_chars;
311
312 if (len == 0)
313 return len;
314
315 do {
316 n_chars = read(desc, ptr, len);
317 } while (n_chars < 0 && errno == EINTR);
318
319 return n_chars;
320}
321
322/* Remove existing file @dest and reopen, creating a new file with @mode */
323static int unlink_and_reopen(const char *dest, mode_t mode)

Callers 1

copy_fileFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected