forked from github/server
fix error detection during report writing
This commit is contained in:
parent
3ea33c6895
commit
7cbd23c26b
|
@ -1543,21 +1543,21 @@ int write_reports(faction * f, time_t ltime)
|
||||||
log_debug("Reports for %s:", factionname(f));
|
log_debug("Reports for %s:", factionname(f));
|
||||||
for (rtype = report_types; rtype != NULL; rtype = rtype->next) {
|
for (rtype = report_types; rtype != NULL; rtype = rtype->next) {
|
||||||
if (f->options & rtype->flag) {
|
if (f->options & rtype->flag) {
|
||||||
int error;
|
int error = 0;
|
||||||
do {
|
do {
|
||||||
char filename[32];
|
char filename[32];
|
||||||
char path[MAX_PATH];
|
char path[MAX_PATH];
|
||||||
sprintf(filename, "%d-%s.%s", turn, factionid(f),
|
sprintf(filename, "%d-%s.%s", turn, factionid(f),
|
||||||
rtype->extension);
|
rtype->extension);
|
||||||
join_path(reportpath(), filename, path, sizeof(path));
|
join_path(reportpath(), filename, path, sizeof(path));
|
||||||
error = 0;
|
errno = 0;
|
||||||
if (rtype->write(path, &ctx, encoding) == 0) {
|
if (rtype->write(path, &ctx, encoding) == 0) {
|
||||||
gotit = true;
|
gotit = true;
|
||||||
}
|
}
|
||||||
if (errno) {
|
if (errno) {
|
||||||
char zText[64];
|
char zText[64];
|
||||||
log_warning("retrying, error %d during %s report for faction %s", error, rtype->extension, factionname(f));
|
log_warning("retrying, error %d during %s report for faction %s", errno, rtype->extension, factionname(f));
|
||||||
sprintf(zText, "waiting %u seconds before we retry", backup / 1000);
|
sprintf(zText, "waiting %u seconds before we retry", backup);
|
||||||
perror(zText);
|
perror(zText);
|
||||||
_sleep(backup);
|
_sleep(backup);
|
||||||
if (backup < maxbackup) {
|
if (backup < maxbackup) {
|
||||||
|
|
Loading…
Reference in New Issue