diff --git a/portable.h b/portable.h index 91be3991..b79f94e8 100644 --- a/portable.h +++ b/portable.h @@ -132,6 +132,7 @@ struct windows_stat { int64_t st_size; int64_t st_mtime; uint32_t st_mode; + uint32_t st_nlink; }; /** @@ -167,6 +168,8 @@ static inline void windows_info2stat(const BY_HANDLE_FILE_INFORMATION* info, str st->st_ino = info->nFileIndexHigh; st->st_ino <<= 32; st->st_ino |= info->nFileIndexLow; + + st->st_nlink = info->nNumberOfLinks; } static inline int windows_fstat(int fd, struct windows_stat* st) diff --git a/scan.c b/scan.c index 77d645b0..c91b3eaf 100644 --- a/scan.c +++ b/scan.c @@ -124,8 +124,13 @@ static void scan_file(struct snapraid_scan* scan, struct snapraid_state* state, if (file) { /* check if multiple files have the same inode */ if (file->is_present) { - fprintf(stderr, "Internal inode '%llu' inconsistency for file '%s'\n", inode, sub); - exit(EXIT_FAILURE); + if (st->st_nlink > 1) { + printf("warning: Ignored hardlink '/%s'\n", sub); + return; + } else { + fprintf(stderr, "Internal inode '%llu' inconsistency for file '%s'\n", inode, sub); + exit(EXIT_FAILURE); + } } /* check if the file is not changed */ @@ -255,7 +260,7 @@ static void scan_dir(struct snapraid_scan* scan, struct snapraid_state* state, s } } else { if (state->verbose) { - printf("warning: Ignored file '/%s'\n", sub_next); + printf("warning: Ignored special file '/%s'\n", sub_next); } } }