summaryrefslogtreecommitdiff
path: root/sponge.c
AgeCommit message (Collapse)AuthorFilesLines
2013-04-02sponge: Check fclose to detect certian short reads. Closes: #704453Joey Hess1-2/+8
2010-09-13minorJoey Hess1-7/+7
2010-09-13put back optimisation when outputting to stdoutJoey Hess1-9/+21
Recent changes made it always write to the tmp file, even if it was just going to send a small quantity of data to stdout. Bring back optimisation to avoid temp file in that case.
2010-09-13sponge: Ensure that output file permissions are always preserved if it ↵Joey Hess1-28/+30
already exists.
2010-09-13indentation changeJoey Hess1-42/+42
2010-09-13sponge: Guarantee that output file is always updated atomically, by renaming ↵Joey Hess1-22/+5
a temp file into place. Closes: #592144
2010-09-02sponge: Correct bad use of fread that caused a trailing quantity of soaked ↵Joey Hess1-4/+5
data to be silently discarded when a temp file was used and sponge output to stdout. Closes: #595220 This bug was sorta introduced by 6f31909ff74c064ea0b5126219b3e8f7b8826bee. Actually, the buggy fread was there before also, and would have happened on quantities of data not evenly divisible by 8.
2008-04-11fix mode of new file renamed from temp fileJoey Hess1-3/+13
2008-04-11minor changesJoey Hess1-5/+7
2008-04-11honor TMPDIRJoey Hess1-6/+19
2008-04-11optimize tempfile copyingJoey Hess1-7/+5
Reuse the buffer and copy in chunks that are the full buffer size.
2008-04-11more fixes to tempfile writebackJoey Hess1-21/+33
Avoid overwriting symlinks with the temp file. When renaming the temp file, restore the original file's permissions after.
2008-04-11set umask before calling mkstempJoey Hess1-1/+3
This is a POSIX portability thing. Restore the original umask after.
2008-04-11fix two bugs writing the output fileJoey Hess1-15/+18
If the output file doesn't exist, the new code was buggy and did not create it. Also, the rename could fail (ie, /tmp on another filesystem). So if it falls fall back to the manual copy.
2008-04-11move code into a functionJoey Hess1-14/+24
2008-04-11fix edge casesJoey Hess1-5/+10
If a file an exact multiple of the max buffer size were sponged, it would fail at the end due to trying to write 0 remaining bytes from the buffer to the temp file. A similar bug occurred if sponge's input was empty. Amazing how such a seemingly simple thing can get so tricky.. Also added check for read error from the temp file, just in case.
2008-04-11reorder definesJoey Hess1-1/+1
2008-04-11set up signal handlers before creating temp fileJoey Hess1-3/+6
Avoids a small race..
2008-04-11another round of whitespace fixesJoey Hess1-54/+55
2008-04-11remove debugBrock Noland1-1/+0
Signed-off-by: Brock Noland <brockn@gmail.com>
2008-04-11sponge fixesBrock Noland1-47/+67
*Fixed many bugs relating to renaming of temp file to output file *Doesn't set umask, not sure what correct behavior is *Does not try and delete /tmp/sponge.XXXXXX on exit if there was no temporary file used *Uses temporary file when buffer * 2 is >= mem_available as the buffer will double shortly after this operation *Only traps signals if we are creating a temporary file *Cleaned up error messages Signed-off-by: Brock Noland <brockn@gmail.com>
2008-04-11better usage messageJoey Hess1-1/+1
2008-04-10first pass thru the codeJoey Hess1-183/+170
Mostly limited to layout consistency changes, but I also moved a block of code into a function, and removed a funky use of enum.
2008-04-10make sponge use a temp file if the input is largeJoey Hess1-21/+232
patch from Brock Noland
2008-04-10sponge: Ensure that suspending/resuming doesn't result in partial writes of ↵Joey Hess1-10/+8
the data, by using fwrite() rather than write().
2006-09-14* spongs: Output to stdout if no file is specified, useful in a pipelinejoeyh1-5/+10
such as: cvs diff | sponge | patch -R -p0 Closes: #387501
2006-08-20* Add missing \n to sponge usage. Closes: #383944joeyh1-1/+1
2006-03-23* Back to Mithandir's C sponge, now fixed.joeyh1-0/+90
2006-03-13releasing version 0.60.6joeyh1-91/+0
2006-03-08* Indentation improvements.joeyh1-48/+48
2006-03-03* Switch sponge to a C implementation by mithandir.joeyh1-0/+91
* Build dep on docbook-xml.