-# Check if the OS can hard-link symlinks or not
-if ln "$fromdir/foo/sym" "$to2dir" 2>/dev/null; then
+# Check if the OS can hard-link symlinks or not.
+# (Note: the link we check MUST NOT point to a valid file!)
+ln -s no-such-dir "$to2dir"
+if ln "$to2dir" "$to2dir.test" 2>/dev/null; then