- if (flist && flist->hlink_pool) {
- if (protocol_version < 28) {
- if (S_ISREG(st.st_mode))
- file->link_u.idev = pool_talloc(
- flist->hlink_pool, struct idev, 1,
- "inode_table");
- } else {
- if (!S_ISDIR(st.st_mode) && st.st_nlink > 1)
- file->link_u.idev = pool_talloc(
- flist->hlink_pool, struct idev, 1,
- "inode_table");
- }
+ if (preserve_hard_links && flist) {
+ if (protocol_version >= 28
+ ? (!S_ISDIR(st.st_mode) && st.st_nlink > 1)
+ : S_ISREG(st.st_mode)) {
+ tmp_idev.dev = st.st_dev;
+ tmp_idev.ino = st.st_ino;
+ } else
+ tmp_idev.dev = tmp_idev.ino = 0;