Changes by: antona
Update of /cvsroot/linux-ntfs/linux-ntfs/ntfstools
In directory usw-pr-cvs1:/tmp/cvs-serv32756
Modified Files:
mkntfs.c
Log Message:
mkntfs alpha 2
create_hardlink() was forgetting to increment the use count!
Index: mkntfs.c
===================================================================
RCS file: /cvsroot/linux-ntfs/linux-ntfs/ntfstools/mkntfs.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -U2 -r1.18 -r1.19
--- mkntfs.c 2001/06/09 16:31:13 1.18
+++ mkntfs.c 2001/06/09 18:32:57 1.19
@@ -2266,4 +2266,12 @@
fn->file_name_length = i;
fn_size = sizeof(FILE_NAME_ATTR) + i * sizeof(uchar_t);
+ /* Increment the link count of @m_file. */
+ i = le16_to_cpu(m_file->link_count);
+ if (i == 0xffff) {
+ Eprintf("Too many hardlinks present already.\n");
+ free(fn);
+ return -EINVAL;
+ }
+ m_file->link_count = cpu_to_le16(i + 1);
/* Add the file_name to @m_file. */
i = insert_resident_attr_in_mft_record(m_file, $FILE_NAME, NULL, 0, 0,
@@ -2274,4 +2282,7 @@
"%s\n", strerror(-i));
free(fn);
+ /* Undo link count increment. */
+ m_file->link_count = cpu_to_le16(
+ le16_to_cpu(m_file->link_count) - 1);
return i;
}
@@ -2283,4 +2294,7 @@
/* FIXME: Remove the file name attribute from @m_file. */
free(fn);
+ /* Undo link count increment. */
+ m_file->link_count = cpu_to_le16(
+ le16_to_cpu(m_file->link_count) - 1);
return i;
}
|