Changes by: cha0smaster
Update of /cvsroot/linux-ntfs/ntfsprogs/libntfs
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30248/libntfs
Modified Files:
dir.c
Log Message:
Thoght that FUSE will check if directory is empty, it didn't. Add such check to ntfs_delete.
Index: dir.c
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfsprogs/libntfs/dir.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -p -r1.20 -r1.21
--- dir.c 14 Aug 2005 15:44:47 -0000 1.20
+++ dir.c 15 Aug 2005 00:50:19 -0000 1.21
@@ -1271,6 +1271,25 @@ int ntfs_delete(ntfs_inode *ni, ntfs_ino
ni = ni->base_ni;
if (dir_ni->nr_extents == -1)
dir_ni = dir_ni->base_ni;
+ /* If deleting directory check it to be empty. */
+ if (ni->mrec->flags & MFT_RECORD_IS_DIRECTORY) {
+ ntfs_attr *na;
+
+ na = ntfs_attr_open(ni, AT_INDEX_ROOT, I30, 4);
+ if (!na) {
+ ntfs_error(, "Corrupt directory or library bug.");
+ errno = EIO;
+ goto err_out;
+ }
+ if (na->data_size != sizeof(INDEX_ROOT) +
+ sizeof(INDEX_ENTRY_HEADER)) {
+ ntfs_attr_close(na);
+ ntfs_error(, "Directory is not empty.");
+ errno = ENOTEMPTY;
+ goto err_out;
+ }
+ ntfs_attr_close(na);
+ }
/*
* Search for FILE_NAME attribute with such name. If it's in POSIX or
* WIN32_AND_DOS namespace, then simply remove it from index and inode.
|