Fix segfault when scanning hard linked files.