Update log.c

This commit is contained in:
Collin 2025-06-27 06:09:32 -05:00 committed by GitHub
parent cd336613b6
commit 20e158f076
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -178,6 +178,7 @@ LogFilePrep(const char *fname, const char *backup, const char *idstring)
if (asprintf(&logFileName, fname, idstring) == -1)
FatalError("Cannot allocate space for the log file name\n");
if (backup && *backup) {
int fd = open(logFileName, O_RDWR | O_NOFOLLOW);
if (fd != -1) {
struct stat buf;
@ -197,7 +198,6 @@ LogFilePrep(const char *fname, const char *backup, const char *idstring)
}
free(oldLog);
}
free(oldLog);
close(fd);
}
}