Set the hidden flag according to the latest name when hide_dot_files is set

When the hide_dot_files option is set, a file is marked hidden if the
first character in its name is a dot. This patch updates the hidden flag
when the file is renamed or hard linked (useful for text editors which
create files with a temporary name)
This commit is contained in:
Jean-Pierre André 2012-03-21 19:19:39 +01:00
parent 4e29280cb2
commit 911ecba5e2
2 changed files with 11 additions and 0 deletions

View File

@ -2075,6 +2075,15 @@ static int ntfs_link_i(ntfs_inode *ni, ntfs_inode *dir_ni, ntfschar *name,
err = EOPNOTSUPP;
goto err_out;
}
if (NVolHideDotFiles(dir_ni->vol)) {
/* Set hidden flag according to the latest name */
if ((name_len > 1)
&& (name[0] == const_cpu_to_le16('.'))
&& (name[1] != const_cpu_to_le16('.')))
ni->flags |= FILE_ATTR_HIDDEN;
else
ni->flags &= ~FILE_ATTR_HIDDEN;
}
/* Create FILE_NAME attribute. */
fn_len = sizeof(FILE_NAME_ATTR) + name_len * sizeof(ntfschar);

View File

@ -227,6 +227,8 @@ Set the hidden flag in the NTFS attribute for created files and directories
whose first character of the name is a dot. Such files and directories
normally do not appear in directory listings, and when the flag is set
they do not appear in Windows directory displays either.
When a file is renamed or linked with a new name, the hidden flag is
adjusted to the latest name.
.TP
.B windows_names
This option prevents files, directories and extended attributes to be