diff options
author | Wayne Davison <wayne@opencoder.net> | 2022-03-27 12:26:39 -0700 |
---|---|---|
committer | Wayne Davison <wayne@opencoder.net> | 2022-03-27 12:52:26 -0700 |
commit | 8977815f5d70d1b6747837b41e7e0b5bd672ef01 (patch) | |
tree | add05cd3b2852ce7c59c413c3b576afc0389611f /receiver.c | |
parent | a48c20c97c151e297d79327912e5c294450c342b (diff) | |
download | rsync-8977815f5d70d1b6747837b41e7e0b5bd672ef01.tar.gz |
Some `--write-device` fixes.
Diffstat (limited to 'receiver.c')
-rw-r--r-- | receiver.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -808,14 +808,16 @@ int recv_files(int f_in, int f_out, char *local_name) continue; } - if (fd1 != -1 && !(S_ISREG(st.st_mode) || (write_devices && IS_DEVICE(st.st_mode)))) { + if (write_devices && IS_DEVICE(st.st_mode)) { + if (fd1 != -1 && st.st_size == 0) + st.st_size = get_device_size(fd1, fname); + /* Mark the file entry as a device so that we don't try to truncate it later on. */ + file->mode = S_IFBLK | (file->mode & ACCESSPERMS); + } else if (fd1 != -1 && !(S_ISREG(st.st_mode))) { close(fd1); fd1 = -1; } - if (fd1 != -1 && IS_DEVICE(st.st_mode) && st.st_size == 0) - st.st_size = get_device_size(fd1, fname); - /* If we're not preserving permissions, change the file-list's * mode based on the local permissions and some heuristics. */ if (!preserve_perms) { |