static int need_fuzzy_dirlist = 0;
struct file_struct *fuzzy_file = NULL;
int fd = -1, f_copy = -1;
- stat_x sx, real_sx;
+ stat_x sx = {0}, real_sx;
STRUCT_STAT partial_st;
struct file_struct *back_file = NULL;
int statret, real_ret, stat_errno;
|| (preserve_specials && ftype == FT_SPECIAL)) {
dev_t rdev;
int del_for_flag;
+ /* Whether the dest existed, captured before the type-mismatch
+ * flip below clears statret -- so atomic_create() gets a delete
+ * flag (and reads sx.st) only when sx.st was actually stat'd. */
+ int dest_existed = (statret == 0);
if (ftype == FT_DEVICE) {
uint32 *devp = F_RDEV_P(file);
rdev = MAKEDEV(DEV_MAJOR(devp), DEV_MINOR(devp));
fname, (int)file->mode,
(long)major(rdev), (long)minor(rdev));
}
- if (atomic_create(file, fname, NULL, NULL, rdev, &sx, del_for_flag)) {
+ if (atomic_create(file, fname, NULL, NULL, rdev, &sx, dest_existed ? del_for_flag : 0)) {
set_file_attrs(fname, file, NULL, NULL, 0);
if (itemizing) {
itemize(fnamecmp, file, ndx, statret, &sx,
fun:main
}
-# rwrite() strlcpy()s a peer log message. read_a_msg() hands it exactly
-# msg_bytes valid bytes with no terminating NUL; the copy is bounded to len,
-# but strlcpy over-reads past the message to compute its (discarded) return
-# length. Harmless read of one+ uninitialised stack byte.
-{
- rsync-rwrite-strlcpy-peer-msg
- Memcheck:Cond
- fun:strlcpy
- fun:strlcpy
- fun:rwrite
-}
-
-# atomic_create()/delete_item() test sxp->st.st_mode when replacing an
-# existing item. Under fakeroot the faked stat overlay leaves mode bits that
-# valgrind treats as uninitialised. Pre-existing hard-link code; fakeroot
-# artifact, not an rsync read of uninitialised memory.
-{
- rsync-atomic-create-stmode
- Memcheck:Cond
- fun:atomic_create
- fun:recv_generator
-}
-{
- rsync-delete-item-stmode
- Memcheck:Cond
- fun:delete_item
- fun:atomic_create
-}
-
# libxxhash returns an internally-aligned XXH3 state whose pointer is offset
# from the malloc base, so valgrind sees only an interior pointer and reports
# the one-time checksum state as "possibly lost". Alignment artifact.