Made sure directories are not hard linked

On OpenIndiana the fuse kernel module does not prevent link(2) from
hard linking directories, so this has to be done in the lowntfs-3g
driver.
edge.strict_endians
Jean-Pierre André 2012-03-21 18:48:38 +01:00
parent e82240f499
commit 319958545e
1 changed files with 6 additions and 0 deletions

View File

@ -2091,6 +2091,12 @@ static int ntfs_fuse_newlink(fuse_req_t req __attribute__((unused)),
goto exit;
}
/* Do not accept linking to a directory (except for renaming) */
if (e && (ni->mrec->flags & MFT_RECORD_IS_DIRECTORY)) {
errno = EPERM;
res = -errno;
goto exit;
}
/* Generate unicode filename. */
uname_len = ntfs_mbstoucs(newname, &uname);
if ((uname_len < 0)