Age | Commit message (Collapse) | Author | Files | Lines |
|
|
|
|
|
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.
|
|
already exists.
|
|
|
|
a temp file into place. Closes: #592144
|
|
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.
|
|
|
|
|
|
|
|
Reuse the buffer and copy in chunks that are the full buffer size.
|
|
Avoid overwriting symlinks with the temp file.
When renaming the temp file, restore the original file's permissions after.
|
|
This is a POSIX portability thing.
Restore the original umask after.
|
|
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.
|
|
|
|
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.
|
|
|
|
Avoids a small race..
|
|
|
|
Signed-off-by: Brock Noland <brockn@gmail.com>
|
|
*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>
|
|
|
|
Mostly limited to layout consistency changes, but I also moved a block of
code into a function, and removed a funky use of enum.
|
|
patch from Brock Noland
|
|
the data, by using fwrite() rather than write().
|
|
such as: cvs diff | sponge | patch -R -p0
Closes: #387501
|
|
|
|
|
|
|
|
|
|
* Build dep on docbook-xml.
|