if (Debug::rotateNumber > 0) {
snprintf(to, MAXPATHLEN, "%s.%d", debug_log_file, 0);
#if _SQUID_WINDOWS_
- remove
- (to);
+ errno = 0;
+ if (remove(to) == -1) {
+ const auto saved_errno = errno;
+ debugs(0, DBG_IMPORTANT, "removal of log file " << to << " failed: " << xstrerr(saved_errno));
+ }
#endif
- rename(debug_log_file, to);
+ errno = 0;
+ if (rename(debug_log_file, to) == -1) {
+ const auto saved_errno = errno;
+ debugs(0, DBG_IMPORTANT, "renaming file " << debug_log_file << " to "
+ << to << "failed: " << xstrerr(saved_errno));
+ }
}
/* Close and reopen the log. It may have been renamed "manually"