[PATCH] `pg_dump -Fd` doesn't check write return status...

From: Sean Chittenden <sean(at)chittenden(dot)org>
To: pgsql-hackers(at)postgresql(dot)org
Subject: [PATCH] `pg_dump -Fd` doesn't check write return status...
Date: 2014-03-01 20:27:19
Message-ID: assp.0137c22fa4.227AE3AA-478D-42AD-BB51-FD90F25157A6@chittenden.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

The attached patch fixes the case when `pg_dump -Fd …` is called on a partition where write(2) fails for some reason or another. In this case, backup jobs were returning with a successful exit code even though most of the files in the dump directory were all zero length.

I haven’t tested this patch’s failure conditions but the fix seems simple enough: cfwrite() needs to have its return status checked everywhere and exit_horribly() upon any failure. In this case, callers of _WriteData() were not checking the return status and were discarding the negative return status (e.g. ENOSPC).

I made a cursory pass over the code and found one other instance where write status wasn’t being checked and also included that.

-sc

Attachment Content-Type Size
pg_dump_check_write.patch application/octet-stream 1.4 KB
unknown_filename text/plain 42 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Vik Fearing 2014-03-01 21:25:29 Re: ALTER TABLE lock strength reduction patch is unsafe
Previous Message Josh Berkus 2014-03-01 18:50:10 Re: commit fest status and release timeline