Don't fclose(NULL) if a file doesn't exist.

This commit is contained in:
Ryan C. Gordon 2017-05-30 20:20:18 -04:00
parent f518f75149
commit 67b0cccc75
1 changed files with 1 additions and 1 deletions

View File

@ -651,10 +651,10 @@ static void applyUpdates(void)
} }
io = fopen(item->fname, "rb"); io = fopen(item->fname, "rb");
fclose(io);
if (io != NULL) { if (io != NULL) {
static int rollbackIndex = 0; static int rollbackIndex = 0;
char rollbackPath[64]; char rollbackPath[64];
fclose(io);
item->rollback = ++rollbackIndex; item->rollback = ++rollbackIndex;
snprintf(rollbackPath, sizeof (rollbackPath), "updates/rollbacks/%d", rollbackIndex); snprintf(rollbackPath, sizeof (rollbackPath), "updates/rollbacks/%d", rollbackIndex);
infof("Moving file for rollback: '%s' -> '%s'", item->fname, rollbackPath); infof("Moving file for rollback: '%s' -> '%s'", item->fname, rollbackPath);