aboutsummaryrefslogtreecommitdiff
path: root/src/xz/file_io.h (follow)
AgeCommit message (Collapse)AuthorFilesLines
2019-06-24xz: Change io_seek_src and io_pread arguments from off_t to uint64_t.Lasse Collin1-2/+2
This helps fixing warnings from -Wsign-conversion and makes the code look better too.
2017-04-05xz: Add io_seek_src().Lasse Collin1-0/+13
2015-03-31xz: Add support for sandboxing with Capsicum.Lasse Collin1-0/+6
The sandboxing is used conditionally as described in main.c. This isn't optimal but it was much easier to implement than a full sandboxing solution and it still covers the most common use cases where xz is writing to standard output. This should have practically no effect on performance even with small files as fork() isn't needed. C and locale libraries can open files as needed. This has been fine in the past, but it's a problem with things like Capsicum. io_sandbox_enter() tries to ensure that various locale-related files have been loaded before cap_enter() is called, but it's possible that there are other similar problems which haven't been seen yet. Currently Capsicum is available on FreeBSD 10 and later and there is a port to Linux too. Thanks to Loganaden Velvindron for help.
2013-06-28xz: Use the self-pipe trick to avoid a race condition with signals.Lasse Collin1-0/+8
It is possible that a signal to set user_abort arrives right before a blocking system call is made. In this case the call may block until another signal arrives, while the wanted behavior is to make xz clean up and exit as soon as possible. After this commit, the race condition is avoided with the input side which already uses non-blocking I/O. The output side still uses blocking I/O and thus has the race condition.
2011-05-01xz: Fix input file position when --single-stream is used.Lasse Collin1-0/+13
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.
2010-01-31Delay opening the destionation file and other fixes.Lasse Collin1-2/+6
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-24Add io_pread().Lasse Collin1-0/+17
It will be used by --list.
2009-11-25Create sparse files by default when decompressing intoLasse Collin1-6/+28
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-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/+86
to avoid problems on systems with system headers with those names.