aboutsummaryrefslogtreecommitdiff
path: root/src/xz/file_io.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2013-06-28xz: Fix error detection of fcntl(fd, F_SETFL, flags) calls.Lasse Collin1-4/+4
POSIX says that fcntl(fd, F_SETFL, flags) returns -1 on error and "other than -1" on success. This is how it is documented e.g. on OpenBSD too. On Linux, success with F_SETFL is always 0 (at least accorinding to fcntl(2) from man-pages 3.51).
2013-06-28xz: Fix use of wrong variable in a fcntl() call.Lasse Collin1-11/+13
Due to a wrong variable name, when writing a sparse file to standard output, *all* file status flags were cleared (to the extent the operating system allowed it) instead of only clearing the O_APPEND flag. In practice this worked fine in the common situations on GNU/Linux, but I didn't check how it behaved elsewhere. The original flags were still restored correctly. I still changed the code to use a separate boolean variable to indicate when the flags should be restored instead of relying on a special value in stdout_flags.
2013-06-28xz: Fix assertion related to posix_fadvise().Lasse Collin1-8/+2
Input file can be a FIFO or something else that doesn't support posix_fadvise() so don't check the return value even with an assertion. Nothing bad happens if the call to posix_fadvise() fails.
2011-05-01xz: Fix input file position when --single-stream is used.Lasse Collin1-0/+15
Now the following works as you would expect: echo foo | xz > foo.xz echo bar | xz >> foo.xz ( xz -dc --single-stream ; xz -dc --single-stream ) < foo.xz Note that it doesn't work if the input is not seekable or if there is Stream Padding between the concatenated .xz Streams.
2011-04-12Remove doubled words from documentation and comments.Lasse Collin1-1/+1
Spot candidates by running these commands: git ls-files |xargs perl -0777 -n \ -e 'while (/\b(then?|[iao]n|i[fst]|but|f?or|at|and|[dt]o)\s+\1\b/gims)' \ -e '{$n=($` =~ tr/\n/\n/ + 1); ($v=$&)=~s/\n/\\n/g; print "$ARGV:$n:$v\n"}' Thanks to Jim Meyering for the original patch.
2011-04-10xz/DOS: Be more careful with the destination file.Lasse Collin1-2/+33
Try to avoid overwriting the source file if --force is used and the generated destination filename refers to the source file. This can happen with 8.3 filenames where extra characters are ignored. If the generated output file refers to a special file like "con" or "prn", refuse to write to it even if --force is used.
2011-04-09xz: Avoid unneeded fstat() on DOS-like systems.Lasse Collin1-6/+8
2011-04-05xz: Use posix_fadvise() if it is available.Lasse Collin1-0/+15
2011-01-26xz: Fix --force on setuid/setgid/sticky and multi-hardlink files.Lasse Collin1-8/+7
xz didn't compress setuid/setgid/sticky files and files with multiple hard links even with --force. This bug was introduced in 23ac2c44c3ac76994825adb7f9a8f719f78b5ee4. Thanks to Charles Wilson.
2010-09-06xz: Improve a comment.Lasse Collin1-3/+4
2010-09-05xz: Update the comment about NetBSD in file_io.c.Lasse Collin1-4/+4
Thanks to Joerg Sonnenberger.
2010-02-12Collection of language fixes to comments and docs.Lasse Collin1-1/+1
Thanks to Jonathan Nieder.
2010-02-01Fix compression of symlinks with --force.Lasse Collin1-1/+13
xz --force accepted symlinks, but didn't remove them after successful compression. Instead, an error message was displayed.
2010-01-31Delay opening the destionation file and other fixes.Lasse Collin1-55/+52
The opening of the destination file is now delayed a little. The coder is initialized, and if decompressing, the memory usage of the first Block compared against the memory usage limit before the destination file is opened. This means that if --force was used, the old "target" file won't be deleted so easily when something goes wrong very early. Thanks to Mark K for the bug report. The above fix required some changes to progress message handling. Now there is a separate function for setting and printing the filename. It is used also in list.c. list_file() now handles stdin correctly (gives an error). A useless check for user_abort was removed from file_io.c.
2010-01-27Silence two compiler warnings on DOS-like systems.Lasse Collin1-0/+3
2010-01-26Use past tense in error message in io_unlink().Lasse Collin1-2/+12
Added a note to translators too. Thanks to Robert Readman.
2010-01-24Add io_pread().Lasse Collin1-0/+25
It will be used by --list.
2010-01-13Don't compress or decompress special files unless writingLasse Collin1-5/+10
to stdout even if --force is used. --force will still enable compression of symlinks, but only in case they point to a regular file. The new way simply seems more reasonable. It matches gzip's behavior while the old one matched bzip2's behavior.
2009-12-07Fix file_io.c on DOS-like systems.Lasse Collin1-0/+4
The problem was introduced when adding sparse file support in 465d1b0d6518c5d980f2db4c2d769f9905bdd902. Thanks to Charles Wilson.
2009-11-28Remove duplicate code in io_open_dest().Lasse Collin1-8/+1
Fix a missing _() in the error message too.
2009-11-25Create sparse files by default when decompressing intoLasse Collin1-34/+209
a regular file. Sparse file creation can be disabled with --no-sparse. I don't promise yet that the name of this option won't change before 5.0.0. It's possible that the code, that checks when it is safe to use sparse output on stdout, is not good enough, and a more flexible command line option is needed to configure sparse file handling.
2009-09-24Fix an error in OpenVMS-specific code.Lasse Collin1-1/+1
Thanks to Jouk Jansen.
2009-09-22Better fixes for OpenVMS support.Lasse Collin1-3/+16
Thanks to Jouk Jansen.
2009-09-19Various changes.Lasse Collin1-21/+22
Separate a few reusable components from XZ Utils specific code. The reusable code is now in "tuklib" modules. A few more could be separated still, e.g. bswap.h. Fix some bugs in lzmainfo. Fix physmem and cpucores code on OS/2. Thanks to Elbert Pol for help. Add OpenVMS support into physmem. Add a few #ifdefs to ease building XZ Utils on OpenVMS. Thanks to Jouk Jansen for the original patch.
2009-06-27Silence a compiler warning on DOS-like systems.Lasse Collin1-1/+4
2009-06-26Updated comments to match renamed files.Lasse Collin1-1/+1
2009-06-26Rename process.[hc] to coder.[hc] and io.[hc] to file_io.[hc]Lasse Collin1-0/+716
to avoid problems on systems with system headers with those names.