* Copyright (C) 1996-2000 Andrew Tridgell
* Copyright (C) 1996 Paul Mackerras
* Copyright (C) 2002 Martin Pool <mbp@samba.org>
- * Copyright (C) 2003, 2004, 2005, 2006, 2007 Wayne Davison
+ * Copyright (C) 2003-2007 Wayne Davison
*
* This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
return;
}
- /* If we're not preserving permissions, change the file-list's
- * mode based on the local permissions and some heuristics. */
- if (!preserve_perms) {
- int exists = statret == 0
- && S_ISDIR(st.st_mode) == S_ISDIR(file->mode);
- file->mode = dest_mode(file->mode, st.st_mode, exists);
- }
-
if (S_ISDIR(file->mode)) {
/* The file to be received is a directory, so we need
* to prepare appropriately. If there is already a
statret = -1;
new_root_dir = 0;
}
+ if (!preserve_perms) { /* See comment in non-dir code below. */
+ file->mode = dest_mode(file->mode, st.st_mode,
+ statret == 0);
+ }
if (statret != 0 && basis_dir[0] != NULL) {
int j = try_dests_non(file, fname, ndx, fnamecmpbuf, &st,
itemizing, code);
return;
}
+ /* If we're not preserving permissions, change the file-list's
+ * mode based on the local permissions and some heuristics. */
+ if (!preserve_perms) {
+ int exists = statret == 0 && !S_ISDIR(st.st_mode);
+ file->mode = dest_mode(file->mode, st.st_mode, exists);
+ }
+
#ifdef SUPPORT_HARD_LINKS
if (preserve_hard_links && F_HLINK_NOT_FIRST(file)
&& hard_link_check(file, ndx, fname, statret, &st, itemizing, code))
if (allowed_lull && !(++j % lull_mod))
maybe_send_keepalive();
else if (!(j % 200))
- maybe_flush_socket();
+ maybe_flush_socket(0);
}
}
if (first_flist->in_progress || first_flist->to_redo)
break;
- if (!read_batch)
+ if (!read_batch) {
write_ndx(sock_f_out, NDX_DONE);
+ maybe_flush_socket(1);
+ }
if (delete_during == 2 || !dir_tweaking) {
/* Skip directory touch-up. */
if (allowed_lull && !(i % lull_mod))
maybe_send_keepalive();
else if (!(i % 200))
- maybe_flush_socket();
+ maybe_flush_socket(0);
}
if (!inc_recurse) {