mirror of
https://github.com/postgres/postgres.git
synced 2025-05-02 11:44:50 +03:00
Remove useless LZ4 system call on failure when writing file header
If an error occurs when writing the LZ4 file header, LZ4F_compressEnd() was called in the error code path of write(), followed by LZ4F_freeCompressionContext() to finish the cleanup. The code as-is was not broken, but the LZ4F_compressEnd() proves to not be necessary as there are no contents to flush at this stage, so remove it. Per gripe from Jeevan Ladhe and Robert Haas. Discussion: https://postgr.es/m/CAOgcT0PE33wbD7giAT1OSkNJt=p-vu8huq++qh=ny9O=SCP5aA@mail.gmail.com
This commit is contained in:
parent
411137a429
commit
f79962d826
@ -193,7 +193,6 @@ dir_open_for_write(const char *pathname, const char *temp_suffix, size_t pad_to_
|
|||||||
{
|
{
|
||||||
/* If write didn't set errno, assume problem is no disk space */
|
/* If write didn't set errno, assume problem is no disk space */
|
||||||
dir_data->lasterrno = errno ? errno : ENOSPC;
|
dir_data->lasterrno = errno ? errno : ENOSPC;
|
||||||
(void) LZ4F_compressEnd(ctx, lz4buf, lz4bufsize, NULL);
|
|
||||||
(void) LZ4F_freeCompressionContext(ctx);
|
(void) LZ4F_freeCompressionContext(ctx);
|
||||||
pg_free(lz4buf);
|
pg_free(lz4buf);
|
||||||
close(fd);
|
close(fd);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user