Commit Graph

468 Commits

Author SHA1 Message Date
Wayne Davison
ede1f0ebc9 The code in send_file_list() needed a little more improvement to
handle --relative really well:
- We must set "is_dot_dir" when we strip off a trailing "/" or "/.".
- If a trailing "/" or "/." caused us to treat a symlink as a dir,
  we now pass our stat() info down to make_file() so that it will
  always treat the cleaned-up name as a dir too.
- We must not strip a leading "/".
- Improved the check for ".." elements in the implied dirs.
2006-01-19 21:16:44 +00:00
Wayne Davison
1902a7652f When --relative is active, simply trim off trailing slashes and
dot dirs.  Also, reject a ".." dir if it would be sent as part
of the relative path.
2006-01-19 01:43:10 +00:00
Wayne Davison
f5a49d0e44 Got rid of a now-unused static variable. 2006-01-17 01:26:35 +00:00
Wayne Davison
5e4ff5f9c5 Merged f_name() with f_name_to(). 2006-01-14 20:26:20 +00:00
Wayne Davison
99aaa6ca25 Fixed a couple out-of-memory function-name strings in make_file(). 2006-01-14 17:19:12 +00:00
Wayne Davison
beaf495400 Added a "continue" missing from a recent change. 2006-01-14 00:29:50 +00:00
Wayne Davison
0ee6ca9800 Got rid of calls to the (soon to vanish) safe_fname() function. 2006-01-13 22:06:31 +00:00
Wayne Davison
97b7bff4d6 - Got rid of a superfluous empty line.
- Indent the "oom:" and "skip_filters:" labels away from column 0.
2005-11-10 16:45:00 +00:00
Wayne Davison
902f03d101 In make_file(), only compute the checksum when we're the sender.
This stops computing useless checksums during the delete scan
when --checksum (-c) was specified.
2005-11-10 06:01:55 +00:00
Wayne Davison
7752df41b7 Compute the right checksum length for the current protocol_version
only once instead of over and over again.
2005-11-10 03:00:38 +00:00
Wayne Davison
2b7e0f33a6 Call tweak_mode() on regular files and dirs if --chmod was specified. 2005-11-07 04:28:32 +00:00
Wayne Davison
56f0c976be Decreased the amount of stack needed for each level of directory
recursion by eliminating the need for a MAXPATHLEN buffer in
send_if_directory().  Also improved a few variable names in
send_file_list().
2005-11-01 20:09:41 +00:00
Wayne Davison
d030233def Get rid of some superfluous empty lines. 2005-10-19 07:49:10 +00:00
Wayne Davison
75c51953f1 - When --dirs is specified w/o --recursive, avoid marking solo dirs
with the XMIT_TOP_DIR flag.
- Only set in_del_hier if --recursive is enabled.
2005-09-29 07:48:05 +00:00
Wayne Davison
8ad5cea371 Changed one strcpy() into a strlcpy(). 2005-09-17 21:49:24 +00:00
Wayne Davison
9a4a237ede Tweaked the code a little in the always_checksum handling of the
send & receive file-list functions.
2005-09-16 05:52:54 +00:00
Wayne Davison
92cdc39372 When pop_dir(olddir) fails, pass the right string pointer
in the error message.
2005-09-09 16:17:01 +00:00
Wayne Davison
d2ea5980ba Allow the user to specify a dot dir in the source path when
using --relative, making it trim the duplicated dirs.
2005-08-01 21:58:16 +00:00
Wayne Davison
151f59f155 Tweaked a comment and some null-char assignments. 2005-07-22 19:09:45 +00:00
Wayne Davison
a1f99493b3 Changed overflow() to overflow_exit(). 2005-07-07 19:49:14 +00:00
Wayne Davison
910ee8c92e In clean_flist(), fixed the setting of the flist->high value for an
empty list so that it can't cause a crash if it gets passed to
flist_find().
2005-06-12 06:07:23 +00:00
Wayne Davison
0f0b2e66b8 Simplified the last change a bit. 2005-05-27 18:15:18 +00:00
Wayne Davison
3a05c5d3ce If we unduplicate '.', make sure we also copy FLAG_DEL_HERE (in
addition to FLAG_TOP_DIR), so that the unduplication of a real
dir and an implied dir (implied by --relative) works right.
2005-05-27 18:04:04 +00:00
Wayne Davison
cbb5fa4f07 Handle nested "." dirs (caused by --relative and a trailing slash or
a trailing "/.") in f_name_cmp() when dirname is not an identical
pointer.
2005-05-25 01:24:01 +00:00
Wayne Davison
a289f89fbe Treat a trailing ".." dir-name as if "../" had been specified so
that we don't use the name in the destination path and save files
into a higher destination directory.
2005-05-14 18:44:57 +00:00
Wayne Davison
557a35f55b If adding a trailing dot to a directory name overflows
MAXPATHLEN, die with an overflow error.
2005-05-13 22:02:24 +00:00
Wayne Davison
7a16e12207 If the user specified --relative and a source dir with a trailing
slash, make sure we strip of the trailing "/." from the dir's len
(in del_hier_name_len) so that its subdirs get marked with
FLAG_DEL_HERE.
2005-04-27 22:56:47 +00:00
Wayne Davison
7b558d7f8b Fixed a comment. 2005-03-30 17:31:35 +00:00
Wayne Davison
53135fe89a Changed maybe_emit_filelist_progress() and emit_filelist_progress()
to take an integer count instead of a struct file_list so that we
can pass in a file-list-count offset for delete's separate calls
to send_directory().
2005-03-29 10:57:31 +00:00
Wayne Davison
301fb56ce9 Split the conditional-directory sending out of send_file_name() into
a new function: send_if_directory().  This lets the code that is
recursively descending through the directories make its list of a
dir's contents and close the DIR handle before recursing into the
subdirs.  Also, the "recurse" var is just true/false once again.
2005-03-14 17:30:15 +00:00
Wayne Davison
a98ad81760 Got rid of some code in f_name_cmp() that tried to make all the
dirname pointers to equivalent strings have identical pointers.
2005-03-14 03:36:56 +00:00
Wayne Davison
d64e6f42b4 Use the new "the_file_list" global. 2005-03-03 18:44:42 +00:00
Wayne Davison
32cbfe7b17 - Moved file-deletion code into generator.c.
- Made filesystem_dev a global that the generator can set during its
  delete pass.
- Fixed an off-by-one boundary check in send_directory().
- Added an arg to get_dirlist() so that delete_in_dir() can call it
  efficiently.
2005-02-26 18:03:46 +00:00
Wayne Davison
89d19eedef Call log_delete() from delete_file() anytime that DEL_TERSE is
not set (we used to only call if verbose or log_format were also
set).
2005-02-26 04:50:55 +00:00
Wayne Davison
d17190df44 Don't add st_size from a device to stats.total_size. 2005-02-25 20:28:27 +00:00
Wayne Davison
87fd439059 When preforming a recursive delete, push/pop the per-dir merge rules. 2005-02-22 20:42:55 +00:00
Wayne Davison
564ef546a9 Sort the dir-list returned by get_dirlist() and the dir-list that
delete_in_dir() generates.
2005-02-22 03:37:18 +00:00
Wayne Davison
94dcbf8367 - Iterate through the deletion list in reverse order so that we
can't delete a backup file that we just created.
- The rename-directory-for-backup heuristic now checks the
  DEL_FORCE_RECURSE flag, not the zap_dir variable.  We also set
  the flag when we recurse so that only the root dir of a deleted
  hierarchy can be missing the flag (and thus be a call from the
  generator).
2005-02-22 03:16:41 +00:00
Wayne Davison
1bad11c759 Only rename a directory with the backup suffix if we're removing
it to replace it with a file of the same name.
2005-02-22 01:59:15 +00:00
Wayne Davison
e1ad7fe63d A couple changes in delete_file() make us more compatible with
older versions: (1) we no longer complain if excluded files
sticking around cause us to not be able to remove a subdir, and
(2) we output the name of the removed subdir after it has been
successfully removed.
2005-02-22 00:42:12 +00:00
Wayne Davison
34e18ecd61 - Moved delete_file() here from rsync.c and improved it to avoid
removing files we just backed up to the current directory and to
  rename a non-empty dir to dir~ (when no backup-dir is specified).
- Made delete_missing() static.
2005-02-21 10:50:30 +00:00
Wayne Davison
8715db2cab Tweaked some externs. 2005-02-20 00:16:23 +00:00
Wayne Davison
e1f40891c7 - Needed to use a name buffer in delete_missing() to avoid having
a recursive delete reuse our buffer from f_name().
- Moved the backup-handling into delete_file() in rsync.c.
- Moved the --max-delete counting into delete_file() in rsync.c.
2005-02-19 23:41:52 +00:00
Wayne Davison
7448177753 - Call log_delete() instead of outputting a "deleting ..." message.
- Call delete_file() with its new arg.
2005-02-19 02:39:15 +00:00
Wayne Davison
37802f40dc - If send_file_name() gets f set to -2, it skips the local filter rules.
- Added get_dirlist(), which returns a file_list structure for the
  desired directory, optionally with local filter rules disabled.
2005-02-14 02:41:23 +00:00
Wayne Davison
bf0c5bec45 If f_name_cmp() discovers that two directory strings compare to an
equal value without being equal pointers, substitute one of the
pointers for the other in the file list.  This optimizes future name
comparisons.  Note also that this optimization won't be triggered
very often (because rsync tends to send the names grouped by dir-
name at transmission time), but it's nice to be able to assume that
all files in the same dir have identical dir-name pointers after the
qsort is finished.
2005-02-14 01:29:17 +00:00
Wayne Davison
4f5b0756df John E. Malmberg convinced me to standardize on #ifs for defined
values instead of non-zero.
2005-02-14 00:53:43 +00:00
Wayne Davison
fe1c19dcdf In clean_flist(), if a duplicate is found for a dir and a non-dir,
always dump the non-dir (because the dir might have contents in
the list).
2005-02-13 22:48:38 +00:00
Wayne Davison
f5db099330 - Made receive_file_entry() return the file_struct pointer instead
of storing it into the files[] array.
- Made flist_find() return "no match" if the found item differs in
  its directory-ness from the search item.
- Changed f_name_cmp() to sort sub-directories after non-directories
  for each directory's contents.  This makes things like the upcoming
  --fuzzy patch easier to get right.
- One complicating factor is that clean_flist() needed some extra
  code to ensure that a directory doesn't duplicate a non-directory
  of the same name.
- Make sure that the "strip_root" code in clean_flist() (for relative
  paths) strips off all leading slashes.
2005-02-13 21:15:47 +00:00
Wayne Davison
8824e2cee4 Changed the prefix on the fnc_state enums. 2005-02-13 10:23:56 +00:00