[PATCH] `pg_dump -Fd` doesn't check write return status... - Mailing list pgsql-hackers

From Sean Chittenden
Subject [PATCH] `pg_dump -Fd` doesn't check write return status...
Date
Msg-id assp.0137c22fa4.227AE3AA-478D-42AD-BB51-FD90F25157A6@chittenden.org
Whole thread Raw
Responses Re: [PATCH] `pg_dump -Fd` doesn't check write return status...  (Bruce Momjian <bruce@momjian.us>)
List 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
directorywere all zero length. 

I haven’t tested this patch’s failure conditions but the fix seems simple enough: cfwrite() needs to have its return
statuschecked everywhere and exit_horribly() upon any failure. In this case, callers of _WriteData() were not checking
thereturn 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
includedthat. 

-sc




--
Sean Chittenden
sean@chittenden.org


Attachment

pgsql-hackers by date:

Previous
From: Josh Berkus
Date:
Subject: Re: commit fest status and release timeline
Next
From: Vik Fearing
Date:
Subject: Re: ALTER TABLE lock strength reduction patch is unsafe