Commit Graph

52 Commits

Author SHA1 Message Date
Wayne Davison
11eb67eec9 Some memory allocation improvements
- All the memory-allocation macros now auto-check for failure and exit
   with a failure message that incudes the caller's file and lineno
   info.  This includes strdup().

 - Added the `--max-alloc=SIZE` option to be able to override the memory
   allocator's sanity-check limit.  It defaults to 1G (as before).
   Fixes bugzilla bug 12769.
2020-06-25 20:54:21 -07:00
Wayne Davison
888ce058d8 Two sparse fixes from Yuxuan Shui.
- Make "len" parameter of do_punch_hole an OFF_T.
- Clear sparse_past_write in sparse_end(), otherwise when write_sparse()
  is called for the next file, do_punch_hole() will be called with a pos
  that's not actually the current position in file, causing it to fail.
2020-05-25 14:01:52 -07:00
Wayne Davison
3ba4db7030 Two more spelling fixes and some year updates. 2020-04-16 09:31:02 -07:00
Wayne Davison
d29702134a Spelling fixes from a Fossies run done by Jens. 2020-04-15 17:42:23 -07:00
Wayne Davison
3e2e4b5a33 Tweak the copyright year. 2019-03-16 09:15:49 -07:00
Wayne Davison
c376170644 Make sure that some memory zeroing always happens. 2019-01-08 14:46:41 -08:00
Wayne Davison
473108ae6e Tweak copyright date. 2018-01-14 19:55:07 -08:00
Wayne Davison
f3873b3d88 Support --sparse combined with --preallocate or --inplace.
The new code tries to punch holes in the destination file using newer
Linux fallocate features. It also supports a --whole-file + --sparse +
--inplace copy on any filesystem by truncating the destination file.
2016-10-10 11:53:03 -07:00
Wayne Davison
453914e35b Update the copyright year. 2015-08-08 12:47:03 -07:00
Wayne Davison
dfa5b49110 Bump the year to 2014. 2014-01-26 09:29:15 -08:00
Wayne Davison
7d7538d43c Fix error in write_sparse() on incomplete write.
Fix a problem where sparse_seek could get left non-zero when we
did not finish writing all the data that would take us to that
sparse gap.  Issue pointed out by David Taylor.
2013-09-16 09:02:46 -07:00
Wayne Davison
7e1a9c4d79 Update copyright year. 2013-01-19 11:05:53 -08:00
Wayne Davison
0ae92567ed Align fileio's map_ptr() reads. Fixes bug 8177. 2013-01-18 15:30:08 -08:00
Wayne Davison
42f759ad9a Reformat a few things for wider lines. 2013-01-18 15:20:43 -08:00
Wayne Davison
96e051c86a Use ftruncate() at the end of a --sparse file.
Fixes bug 7337.
2010-11-06 10:13:16 -07:00
Wayne Davison
b3bf9b9df9 Update the copyright year. 2009-01-03 10:57:14 -08:00
Wayne Davison
e4ed195bb7 Change some size_t vars to ints. 2008-11-11 18:06:11 -08:00
Wayne Davison
faf980ffb5 Make sparse_seek an OFF_T (pointed out by Pedro Valasco). 2008-11-11 18:05:27 -08:00
Wayne Davison
5dd14f0c33 Split up the ifuncs.h file into 3 .h files. 2008-09-01 19:11:36 -07:00
Wayne Davison
adc2476fa2 Output numbers in 3-digit groups by default (e.g. 1,234,567).
Also improved the human-readable output functions, including
adding the ability to output negative numbers.
2008-09-01 13:27:11 -07:00
Wayne Davison
6d56efa6ea Changed human_num() to big_num() with an extra arg so that it can
be used in place of all %.0f output idioms.
2008-07-17 07:37:31 -07:00
Wayne Davison
d3d07a5e86 Include 2008 in the copyright years. 2008-03-01 12:01:41 -08:00
Wayne Davison
7e4b6b7bc4 Use new0() function instead of new() followed by memset(). 2007-09-03 04:19:11 +00:00
Wayne Davison
8e41b68e8f Tweaking the license text a bit more. 2007-07-10 13:55:49 +00:00
Wayne Davison
4fd842f98d Switching to GPL 3. 2007-07-07 05:33:14 +00:00
Wayne Davison
6aa27a7ce5 - Do less seeking when writing a sparse file.
- Don't rewrite the last byte of a file in sparse mode when the
  file didn't end with a null char.
2007-05-26 21:46:22 +00:00
Wayne Davison
ba2133d6ad Further modifications to the copyright comment section. 2007-02-04 14:54:58 +00:00
Wayne Davison
18233a170e Only sparse_files > 0 now indicates option is enabled. 2006-12-28 07:54:04 +00:00
Wayne Davison
264042760b Use an explicit cast when a value gets stored in a smaller var. 2006-11-21 08:35:58 +00:00
Wayne Davison
e7c67065c0 Updated the FSF's address to an even newer one. 2006-04-25 23:51:12 +00:00
Wayne Davison
0f78b81511 - Updated the address for the FSF in the opening comment.
- Standardized the format of the opening comment, including adding a
  brief description of what's in the file for those that lacked it.
- Added some missing copyright lines.
- Some minor whitespace tweaks (in a few of the files).
2006-04-25 20:23:34 +00:00
Wayne Davison
e3db43ffe5 Fixed the value of map->p_fd_offset when a read() fails or is
abbreviated.
2006-04-08 16:37:50 +00:00
Wayne Davison
1348267518 If we get less data than expected from a read() in map_ptr(), we
need to try to keep reading to see if we get an error or more data.
2005-09-21 17:37:41 +00:00
Wayne Davison
705de51a73 Improved do_lseek()'s failure message. 2005-02-27 21:12:13 +00:00
Wayne Davison
54281fe733 - Changed the map_size parameter to map_file() to be an int32 named
"read_size".
- Changed some int vars in map_ptr() needed to be int32 vars.
- All callers expect map_ptr() to return back the full "len" bytes,
  so we never shorten this value, even near EOF--the read will
  just get zero-padded, as needed.
- Die with an error if someone calls map_ptr() with a len < 0, or
  if read_size is computed as a value < 0.
2005-01-17 22:51:17 +00:00
Wayne Davison
7aac6604c4 - Use an int32 for the each block-size variable.
- Renamed the local block_size arg to blk_size (to avoid
  confusion with the global block_size variable).
2005-01-01 21:08:07 +00:00
Wayne Davison
6e8a1782ab - Changed the calling syntax for map_file() so that it takes both
a (possibly approximate) window size and an optional block size
  (which is used to round-up the window size if it is non-zero).
- Don't set window_start behind the supplied offset in map_ptr().
2004-08-03 08:05:29 +00:00
Wayne Davison
7f290d5c82 - Added a new block_size arg to map_file(). Use it to set the
new def_window_size member variable.
- Got rid of max_map_size global (we use def_window_size now).
2004-07-20 21:35:52 +00:00
Wayne Davison
510b4cd4d5 Added a max_map_size variable, initialized to MAX_MAP_SIZE. 2004-07-16 18:02:30 +00:00
Wayne Davison
c7e11bfdc0 Make wf_writeBufSize based on a multiple of WRITE_SIZE instead
of the unrelated MAX_MAP_SIZE.
2004-07-16 01:32:02 +00:00
Wayne Davison
bf2b7ddfc5 Use memset() to initialize a new map_struct. 2004-05-11 19:46:56 +00:00
Wayne Davison
13aefa1365 Some whitespace tweaks. 2004-01-05 03:57:15 +00:00
Wayne Davison
9b9c8aaf4d Improved flush_write_file(). 2004-01-02 18:42:33 +00:00
Wayne Davison
76c2194714 Applying my updated version of Craig Barratt's buffered I/O patch. 2004-01-02 08:29:49 +00:00
Wayne Davison
58cadc8608 Merged in the security fixes from 2.5.7. 2003-12-06 21:07:27 +00:00
J.W. Schultz
6a7cc46cb2 Detect and report when open or opendir succeed but read and
readdir fail caused by network filesystems issues and
truncated files.
			Thanks to David Norwood and Michael Brown
2003-09-16 02:49:59 +00:00
J.W. Schultz
9533e15a79 Changed write file to cope with partial writes by looping
until complete or errno is set.
					(John Van Essen)
2003-05-22 23:24:44 +00:00
Martin Pool
a261989cda More signedness fixes; should be harmless. 2002-01-25 23:07:33 +00:00
Martin Pool
9dd891bb28 Signedness security patch from Sebastian Krahmer <krahmer@suse.de> --
in some cases we were not sufficiently careful about reading integers
from the network.

Also, make sure log messages are always nul-terminated.
2002-01-23 04:57:18 +00:00
Andrew Tridgell
4440b8aa3f no longer use mmap() in rsync because of the risk of a SIGBUS when
another program (such as a mailer) truncates a file.

To offset the speed loss I have rewritten the map_ptr() code to make
much better use of read().
1998-12-30 14:48:45 +00:00