Commit graph

205 commits

Author SHA1 Message Date
Chris Spiegel fb3762ee97 Clear sa_mask and sa_handler before calling sigaction(). 2015-01-31 22:51:11 -08:00
Elmir Jagudin 14a824da2c added '-m' command line option
Added an option to override detected available ram. Can be used
to limit the amount of ram used by lrzip.
2014-06-18 16:24:19 +02:00
Con Kolivas d8df50c9b7 Update various copyright dates. 2013-09-02 12:21:54 +10:00
Con Kolivas 1aa0c0fdd0 Fix crash with -S by not freeing control->suffix. 2012-07-13 10:40:41 +10:00
Con Kolivas 275523661d Revert "Fix invalid free error when -o and -S are used together."
This reverts commit 0d6944bd3f.

Breaks lrztar.
2012-07-13 10:38:29 +10:00
Con Kolivas 184a8f0025 Rename lrzip.h to lrzip_core.h to cope with case insensitive filesystems not working with Lrzip.h vs lrzip.h 2012-07-07 21:39:40 +10:00
Con Kolivas 0d6944bd3f Fix invalid free error when -o and -S are used together. 2012-07-07 21:02:35 +10:00
Con Kolivas 14c3ce2ab4 Calling lrzip via lrzcat would fail as the proper parameters weren't being passed to the control structure. Fix. 2012-03-10 20:47:57 +11:00
Con Kolivas dbc71eceb1 Store a copy of the control struct to be reused on subsequent files to prevent variables being modified in the control struct on the first file that
corrupt compression/decompression of the 2nd file.
2012-03-07 22:19:14 +11:00
Con Kolivas 086265c83f Update copyright notices and style to 1TBS for return codes. 2012-03-07 22:04:24 +11:00
discomfitor 949c6d7a97 another semi-clusterfuck commit: *new logging macros *allow compression to and from any FILE, not just stdin/stdout *update main.c to work with the above 2011-08-17 20:59:41 +10:00
discomfitor 6dd20d735b giant clusterfuck commit: *add and use alloca/strdupa in some spots *implement return values on almost every function *free() is now a macro which also nulls the freed pointer *when in 'library mode', fatal_exit() will not be called *fatal()/failure() are now macros which add line number and file for logging *all occurrences of fatal/failure in files other than main.c are now wrapped to use a logging callback (if specified) and then return *functions now clean up resources on returning with an error 2011-08-17 20:59:40 +10:00
discomfitor 133b201867 move more code out of main.c, allocate outfile suffix 2011-08-17 20:59:40 +10:00
discomfitor cbff8faef7 move liblrzip.h contents to lrzip_private.h global variables----- 2011-08-17 20:59:40 +10:00
discomfitor e85e4df0ef move compression overhead calcs out of main() 2011-08-17 20:59:40 +10:00
discomfitor 1c64dcfb31 more initialization stuff out of main(), remove weird coincidentally successful one_g variable 2011-08-17 20:59:40 +10:00
discomfitor cfd6915b20 move some initialization stuff out of main() 2011-08-17 20:59:40 +10:00
discomfitor 87120e0f75 use liblrzip.h defines in main.c 2011-08-17 20:59:40 +10:00
discomfitor 59f10b2c9c move functions+defines out of main.c 2011-08-17 20:59:40 +10:00
Con Kolivas d033743e6f Add lrzcat symlink which automatically decompresses to stdout.
Revert automatic compression/decompression to stdout when not outputting to a tty, to be consistent with gzip.
2011-05-07 13:22:35 +10:00
Con Kolivas 5352debf15 Change to detecting only whether lrzip is inappropriately being passed a directory since there may be other valid file types. 2011-04-22 19:35:04 +10:00
Con Kolivas e8824afa1b Do a sanity check on infile in lrzip to ensure it's working on a file it can compress. 2011-04-22 19:23:40 +10:00
Con Kolivas 30e990fbcf Add encrypt support to lrzip.conf 2011-04-22 18:49:24 +10:00
ckolivas 77f17857e7 Use STDOUT when no filename is specified and we detect stdout is not going to the terminal. 2011-04-20 11:56:02 +10:00
ckolivas 1456fcc0c6 Merge branch 'master' of github.com:ckolivas/lrzip 2011-04-13 15:02:35 +10:00
ckolivas 271e97d8be Update displayed compression window to match what will be used. 2011-04-13 14:24:02 +10:00
Con Kolivas c1055d173e Clamp largest 32bit usable chunk to 2/3 of 1GB. 2011-04-12 14:40:51 +10:00
Con Kolivas e66d97ab19 Show full version properly when -V is invoked with new versioning system. 2011-04-03 20:13:16 +10:00
Con Kolivas b27e1df879 Revert "Modify the file format to not include rzip chunk size except for STDOUT chunked files thus decreasing the file format size further."
This reverts commit 131d4c92c2.

Breaks STDIN/OUT so revert this change and cope with the slightly extra file size on non-chunked files.
2011-03-23 07:59:04 +11:00
Con Kolivas 8077412ee5 Allow files with non-standard extensions to be tested or decompressed if they actually exist.
Don't allow a suffix if an actual output filename has been specified.
Convert ints to chars when they can be.
2011-03-23 01:51:40 +11:00
Con Kolivas 70e7866271 Include arpa/inet.h for those OSs that have endian details elsewhere. 2011-03-22 21:47:24 +11:00
Con Kolivas 4bc8faa526 Storage time is only meaningful on compression. 2011-03-22 21:37:10 +11:00
Con Kolivas bdf19e2654 nloop cleanup courtesy Serge Belyshev. 2011-03-22 21:34:04 +11:00
ckolivas f56e48c4f2 Modify maxram to mean the most we'll allocate in one chunk and add usable_ram for the most we'll allocate to one task.
Limit all maxram on 32bits to 1GB since most don't like mallocing more than this.
Update testing to allow larger total amount based on usable ram while sticking to maxram limit per alloc.
2011-03-22 12:10:21 +11:00
Con Kolivas 68cca4dea5 More streamlining of version number. Fixes problems with osx version displayed. 2011-03-22 09:06:13 +11:00
Con Kolivas 131d4c92c2 Modify the file format to not include rzip chunk size except for STDOUT chunked files thus decreasing the file format size further. 2011-03-22 09:04:24 +11:00
Con Kolivas 2736118f82 Check for different endian.h includes and variants of le32toh. 2011-03-22 07:57:32 +11:00
Con Kolivas 93f7c602d0 Fixes for 32 bit limits and osx compilation. 2011-03-22 00:46:12 +11:00
Con Kolivas 0b1db75a44 Cleanups. 2011-03-19 13:53:43 +11:00
Con Kolivas 53a6dfd723 Add manpage entry for encryption option. 2011-03-18 23:38:02 +11:00
ckolivas 5005c2dff5 Get rid of extra data in new header and stick to old header size, compacting extra info into existing space. 2011-03-18 17:32:47 +11:00
ckolivas b8d8ecfe33 Fix warnings.
Patch ~ by Serge Belyshev.
2011-03-18 10:37:09 +11:00
Con Kolivas f758773cd0 Fix one minor leak. 2011-03-16 13:29:47 +11:00
Con Kolivas 412cf013c4 Implement passphrase input. 2011-03-15 16:32:32 +11:00
Con Kolivas 202d972a6c Add encryption -e option and flag encryption with a control flag, removing encrypt field. 2011-03-15 15:04:58 +11:00
Con Kolivas 65f901a83c Get the seconds, salt and encryption loop data before compressing.
Store seconds in only 5 bytes which is enough for 400 years, leaving more room for random data.
2011-03-15 14:41:47 +11:00
ckolivas fca5d4232c Refuse to perform file info from STDIN. 2011-03-15 09:56:45 +11:00
Con Kolivas 00be150cfb Add flag tests for TMP_INBUF. 2011-03-14 14:56:59 +11:00
Con Kolivas 684959efed Add fields for temporary input buffer and clamp memory accordingly in preparation. 2011-03-14 14:47:26 +11:00
Con Kolivas 9e772d3140 Make ALL decompression use temporary in-ram buffer whenever possible. 2011-03-14 12:48:40 +11:00
Con Kolivas d9e9f0d71d No need to keep usable_ram as a rzip_control variable. 2011-03-13 22:28:28 +11:00
Con Kolivas 66fe056f30 Don't use open coded flags. 2011-03-13 22:22:46 +11:00
Con Kolivas 17c35cb331 Use the usable_ram variable just to determine the maximum size allocatable. 2011-03-13 22:16:46 +11:00
Con Kolivas 6ac74aa9f0 Create a flag to know when the temporary output buffer is in use, in preparation for when we use it on decompression. 2011-03-13 08:34:06 +11:00
Con Kolivas d2ae072a3c Round to page for optimum efficiency. 2011-03-12 22:58:39 +11:00
Con Kolivas 9444441d51 Modify maximum ram usable when stdout is being used in preparation for temporary in-ram file during stdout and fix summary shown and 32 bit limits. 2011-03-12 12:19:02 +11:00
Con Kolivas 34a44d16b3 Close config file. 2011-03-09 13:41:16 +11:00
Con Kolivas e22967db11 Remove unused s char. 2011-03-09 13:32:37 +11:00
Con Kolivas 2db75fe408 Get rid of trailing whitespace 2011-03-09 08:50:46 +11:00
Con Kolivas 1a7c409e10 header-mangling-part-X-move-all-headers-defines-into 2011-03-09 08:37:26 +11:00
Con Kolivas 99c3ea2ab9 header-mangling-part-3-remove-ugly-hacks-for-liblrzi 2011-03-09 08:36:07 +11:00
Con Kolivas 1511c27aad header-mangling-part-2-move-all-function-prototypes 2011-03-09 08:34:44 +11:00
Con Kolivas e5dfd2d9d8 header-mangling-part-1-move-functions-out-of-headers 2011-03-09 08:33:44 +11:00
Con Kolivas f6f0a25ef6 rebase-of-function-split-and-control-additions-to-fu 2011-03-09 08:32:14 +11:00
ckolivas 59e5bc0492 Remove all open coded strerrors when they're going to be shown by fatal(). 2011-03-08 12:05:03 +11:00
ckolivas 2a8cad1a28 Check for any unusual entries in get_fileinfo and abort. 2011-03-08 11:43:56 +11:00
ckolivas 9499a7b453 STDOUT does not affect the compression window in master branch. 2011-03-08 08:24:05 +11:00
Con Kolivas ef15ea28a8 Display outputting message only if not testing. 2011-03-07 21:18:15 +11:00
Con Kolivas 44ed5727b3 Clean up and fix times displayed.
Merge fixes.
2011-03-07 21:05:20 +11:00
ckolivas c6199980f0 Disable file checking when not possible or meaningful. 2011-03-07 20:53:59 +11:00
Con Kolivas 10b1201f82 Fix more of the dodgy merge. 2011-03-07 17:28:50 +11:00
Con Kolivas 9fc551c159 Merge branch 'temp'
Conflicts:
	main.c
2011-03-07 17:25:10 +11:00
Con Kolivas 13a6fb5b43 Dump the temporary file generated to emulate stdout at the end of each chunk on decompression and then truncate the file instead of writing the whole file before dumping it. 2011-03-07 17:14:07 +11:00
Con Kolivas 8a4df9774f Forgot two instances of temporary outfiles that need to be unlinked. 2011-03-07 13:44:29 +11:00
Con Kolivas 68469c2b6f Don't dump output to stdout when testing. 2011-03-07 13:41:00 +11:00
Con Kolivas 06fd0a3528 Unlink files in safe places. 2011-03-07 13:40:43 +11:00
Con Kolivas f9046e6756 Check free space after reading magic, and not when decompressing to stdout. 2011-03-07 13:36:03 +11:00
Con Kolivas 8fa01248e7 Unlink temporary files immediately to avoid files lying around in cases of unexpected/uncaught failure. 2011-03-07 13:33:14 +11:00
Con Kolivas 38eca38743 Unify maxram allocation and limit threads when there isn't enough ram. 2011-03-07 13:23:14 +11:00
Con Kolivas e42916e51f Revert "Make sure to realloc filenames when making physical temp files to not have memory leaks."
This reverts commit 9c3d492524.

Oops, dirty commit.
2011-03-07 13:08:40 +11:00
Con Kolivas 8a4814081b Must read magic before testing free space.
Resolve conflict.
2011-03-07 13:06:30 +11:00
ckolivas d1dc3dd6b1 Don't bother zeroing variables that are already zeroed by memset. 2011-03-07 13:04:01 +11:00
Con Kolivas 9c3d492524 Make sure to realloc filenames when making physical temp files to not have memory leaks.
Fix conflict in merge.
2011-03-07 13:02:17 +11:00
ckolivas 81500282cc Move verbose summary till after we know if we have STDIN and STDOUT to more accurately reflect the window chosen. 2011-03-07 12:57:53 +11:00
Con Kolivas 96efe033fd Ignore what stdout is going to when testing from stdin. 2011-03-07 12:56:10 +11:00
Con Kolivas 624de254ce Revert "Fallocate space in advance on decompression."
This reverts commit cf03cb0c04.

Fallocating for some reason fails to write the end of the file! Revert change pending further investigation.
2011-02-28 22:13:36 +11:00
Con Kolivas 9e548448d6 Checked for the wrong standard. 2011-02-28 21:18:53 +11:00
Con Kolivas cf03cb0c04 Fallocate space in advance on decompression.
This often can speed up decompression of large files and decreases fragmentation.
2011-02-26 23:26:00 +11:00
Con Kolivas fd5a77ac21 Check on the fd_out on decompression, NOT on fd_in. 2011-02-26 23:19:50 +11:00
Con Kolivas 8bdd5688c8 Check for free space before compression/decompression and abort if -f option is not enabled. 2011-02-26 23:10:28 +11:00
ckolivas 9b60d6e703 Update manpage to new, cleaner help format. 2011-02-25 10:55:27 +11:00
ckolivas 3a818196cc Perform sanity testing on file information output which detects corrupted archives. 2011-02-25 09:31:35 +11:00
Con Kolivas 573aa534ac Display the offset of each block in verbose information as well. 2011-02-25 09:21:30 +11:00
Con Kolivas d90f670fbd The output from information is confusing on 32 bit when it cuts the available ram for internal use.
Display the actual amount of ram detected, and then decrease the value for calculating what the calculated window will be.
Move the variables to where they're only used locally.
2011-02-23 23:58:50 +11:00
Con Kolivas 48e7e31dad Make sure to not delete files that already exist and we've refused to overwrite! 2011-02-23 15:01:43 +11:00
Con Kolivas 9fef6ab803 Add verbose and max verbose modes for -i information.
This will give a breakdown of each rzip chunk and compressed block by jumping to each head offset and reading the header information.
2011-02-23 12:59:59 +11:00
Con Kolivas 8edc4bd052 Trivial 2011-02-23 01:29:17 +11:00
Con Kolivas 32ff6edf9a Only set the main process nice value to less when a back-end compression is enabled. 2011-02-23 01:26:51 +11:00
Con Kolivas e79127ace8 Trivial changes. 2011-02-23 01:22:54 +11:00
Con Kolivas 94673d3fe3 Change the LZO testing option to be a bool on/off instead of taking a confusing parameter.
Make the lzo testing message simpler and only appear when max verbose mode is enabled.
2011-02-23 01:15:18 +11:00