Skip to content

Add detailed error information for filtered_fwrite failures #780

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions log.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,12 @@ static void filtered_fwrite(FILE *f, const char *in_buf, int in_len, int use_isp
while (in_buf < end) {
if (ob - outbuf >= (int)sizeof outbuf - 10) {
if (fwrite(outbuf, ob - outbuf, 1, f) != 1)
{
int fwrite_errno = errno;
FILE *fp = (f == stderr) ? stdout : stderr;
fprintf(fp, "filtered_fwrite(): fwrite() error: %s [%s]\n", strerror(fwrite_errno), who_am_i());
exit_cleanup(RERR_MESSAGEIO);
}
ob = outbuf;
}
if ((in_buf < end - 4 && *in_buf == '\\' && in_buf[1] == '#'
Expand All @@ -242,7 +247,12 @@ static void filtered_fwrite(FILE *f, const char *in_buf, int in_len, int use_isp
if (end_char) /* The "- 10" above means that there is always room for one more char here. */
*ob++ = end_char;
if (ob != outbuf && fwrite(outbuf, ob - outbuf, 1, f) != 1)
{
int fwrite_errno = errno;
FILE *fp = (f == stderr) ? stdout : stderr;
fprintf(fp, "filtered_fwrite(): fwrite() error: %s [%s]\n", strerror(fwrite_errno), who_am_i());
exit_cleanup(RERR_MESSAGEIO);
}
}

/* this is the underlying (unformatted) rsync debugging function. Call
Expand Down