MCPcopy Create free account
hub / github.com/F-Stack/f-stack / UTIL_isSameFile

Function UTIL_isSameFile

freebsd/contrib/zstd/programs/util.c:220–238  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

218}
219
220int UTIL_isSameFile(const char* fName1, const char* fName2)
221{
222 assert(fName1 != NULL); assert(fName2 != NULL);
223#if defined(_MSC_VER) || defined(_WIN32)
224 /* note : Visual does not support file identification by inode.
225 * inode does not work on Windows, even with a posix layer, like msys2.
226 * The following work-around is limited to detecting exact name repetition only,
227 * aka `filename` is considered different from `subdir/../filename` */
228 return !strcmp(fName1, fName2);
229#else
230 { stat_t file1Stat;
231 stat_t file2Stat;
232 return UTIL_stat(fName1, &file1Stat)
233 && UTIL_stat(fName2, &file2Stat)
234 && (file1Stat.st_dev == file2Stat.st_dev)
235 && (file1Stat.st_ino == file2Stat.st_ino);
236 }
237#endif
238}
239
240/* UTIL_isFIFO : distinguish named pipes */
241int UTIL_isFIFO(const char* infilename)

Callers 2

FIO_openDstFileFunction · 0.85

Calls 2

strcmpFunction · 0.85
UTIL_statFunction · 0.85

Tested by

no test coverage detected