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

Function rsyserr

log.c:453–479  ·  view source on GitHub ↗

This is like rprintf, but it also tries to print some * representation of the error code. Normally errcode = errno. * * Unlike rprintf, this always adds a newline and there should not be * one in the format string. * * Note that since strerror might involve dynamically loading a * message catalog we need to call it once before chroot-ing. */

Source from the content-addressed store, hash-verified

451 * Note that since strerror might involve dynamically loading a
452 * message catalog we need to call it once before chroot-ing. */
453void rsyserr(enum logcode code, int errcode, const char *format, ...)
454{
455 va_list ap;
456 char buf[BIGPATHBUFLEN];
457 size_t len;
458
459 /* snprintf returns the would-have-been length on truncation, so
460 * each cumulative call must be guarded; if not, sizeof buf - len
461 * can underflow when promoted to size_t and the next call writes
462 * past the buffer. */
463 len = snprintf(buf, sizeof buf, RSYNC_NAME ": [%s] ", who_am_i());
464
465 if (len < sizeof buf) {
466 va_start(ap, format);
467 len += vsnprintf(buf + len, sizeof buf - len, format, ap);
468 va_end(ap);
469 }
470
471 if (len < sizeof buf) {
472 len += snprintf(buf + len, sizeof buf - len,
473 ": %s (%d)\n", strerror(errcode), errcode);
474 }
475 if (len >= sizeof buf)
476 exit_cleanup(RERR_MESSAGEIO);
477
478 rwrite(code, buf, len, 0);
479}
480
481void rflush(enum logcode code)
482{

Callers 15

successful_sendFunction · 0.70
send_filesFunction · 0.70
hard_link_checkFunction · 0.70
hard_link_oneFunction · 0.70
finish_hard_linkFunction · 0.70
skip_matchedFunction · 0.70
map_ptrFunction · 0.70
piped_childFunction · 0.70
local_childFunction · 0.70
logfile_openFunction · 0.70
open_batch_filesFunction · 0.70
write_batch_shell_fileFunction · 0.70

Calls 3

strerrorFunction · 0.85
rwriteFunction · 0.85
who_am_iFunction · 0.70

Tested by

no test coverage detected