AOF: be future-proof and close the file pointer.
Currently useless but we release the fake client, so better to do a full cleanup. Thanks to @TomMD reporting this in #6353.
This commit is contained in:
parent
b2e10131c0
commit
f7090f43ad
@ -862,6 +862,7 @@ loaded_ok: /* DB loaded, cleanup and return C_OK to the caller. */
|
|||||||
readerr: /* Read error. If feof(fp) is true, fall through to unexpected EOF. */
|
readerr: /* Read error. If feof(fp) is true, fall through to unexpected EOF. */
|
||||||
if (!feof(fp)) {
|
if (!feof(fp)) {
|
||||||
if (fakeClient) freeFakeClient(fakeClient); /* avoid valgrind warning */
|
if (fakeClient) freeFakeClient(fakeClient); /* avoid valgrind warning */
|
||||||
|
fclose(fp);
|
||||||
serverLog(LL_WARNING,"Unrecoverable error reading the append only file: %s", strerror(errno));
|
serverLog(LL_WARNING,"Unrecoverable error reading the append only file: %s", strerror(errno));
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@ -892,11 +893,13 @@ uxeof: /* Unexpected AOF end of file. */
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (fakeClient) freeFakeClient(fakeClient); /* avoid valgrind warning */
|
if (fakeClient) freeFakeClient(fakeClient); /* avoid valgrind warning */
|
||||||
|
fclose(fp);
|
||||||
serverLog(LL_WARNING,"Unexpected end of file reading the append only file. You can: 1) Make a backup of your AOF file, then use ./redis-check-aof --fix <filename>. 2) Alternatively you can set the 'aof-load-truncated' configuration option to yes and restart the server.");
|
serverLog(LL_WARNING,"Unexpected end of file reading the append only file. You can: 1) Make a backup of your AOF file, then use ./redis-check-aof --fix <filename>. 2) Alternatively you can set the 'aof-load-truncated' configuration option to yes and restart the server.");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
||||||
fmterr: /* Format error. */
|
fmterr: /* Format error. */
|
||||||
if (fakeClient) freeFakeClient(fakeClient); /* avoid valgrind warning */
|
if (fakeClient) freeFakeClient(fakeClient); /* avoid valgrind warning */
|
||||||
|
fclose(fp);
|
||||||
serverLog(LL_WARNING,"Bad file format reading the append only file: make a backup of your AOF file, then use ./redis-check-aof --fix <filename>");
|
serverLog(LL_WARNING,"Bad file format reading the append only file: make a backup of your AOF file, then use ./redis-check-aof --fix <filename>");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user