diff --git a/common/dirhelpers.c b/common/dirhelpers.c index b5e01b2b..09e06369 100644 --- a/common/dirhelpers.c +++ b/common/dirhelpers.c @@ -330,7 +330,10 @@ bool ladish_rotate(const char * src, const char * dst, unsigned int max_backups) bool oldest_found; unsigned int backup; + ASSERT(max_backups > 0); + oldest_found = false; + path = NULL; older_path = NULL; backup = max_backups; while (backup > 0) @@ -383,6 +386,8 @@ bool ladish_rotate(const char * src, const char * dst, unsigned int max_backups) backup--; } + ASSERT(path != NULL); + log_info("rename '%s' -> '%s'", dst, path); if (rename(dst, path) != 0 && errno != ENOENT) {