svn commit: samba r3351 - in branches/SAMBA_4_0/source/ntvfs/posix: .

tridge at samba.org tridge at samba.org
Fri Oct 29 04:43:28 GMT 2004


Author: tridge
Date: 2004-10-29 04:43:28 +0000 (Fri, 29 Oct 2004)
New Revision: 3351

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=3351

Log:
handle far more operations on open directory handles. pvfs was failing
with a wxp client because of qfileinfo operations on directories
failing with NT_STATUS_INVALID_HANDLE after the fstat() failed (as
pvfs sets f->fd to -1 for directories)

Modified:
   branches/SAMBA_4_0/source/ntvfs/posix/pvfs_flush.c
   branches/SAMBA_4_0/source/ntvfs/posix/pvfs_resolve.c
   branches/SAMBA_4_0/source/ntvfs/posix/pvfs_setfileinfo.c


Changeset:
Modified: branches/SAMBA_4_0/source/ntvfs/posix/pvfs_flush.c
===================================================================
--- branches/SAMBA_4_0/source/ntvfs/posix/pvfs_flush.c	2004-10-29 03:48:49 UTC (rev 3350)
+++ branches/SAMBA_4_0/source/ntvfs/posix/pvfs_flush.c	2004-10-29 04:43:28 UTC (rev 3351)
@@ -28,6 +28,9 @@
 */
 static void pvfs_flush_file(struct pvfs_state *pvfs, struct pvfs_file *f)
 {
+	if (f->name->dos.attrib & FILE_ATTRIBUTE_DIRECTORY) {
+		return;
+	}
 	if (pvfs->flags & PVFS_FLAG_STRICT_SYNC) {
 		fsync(f->fd);
 	}

Modified: branches/SAMBA_4_0/source/ntvfs/posix/pvfs_resolve.c
===================================================================
--- branches/SAMBA_4_0/source/ntvfs/posix/pvfs_resolve.c	2004-10-29 03:48:49 UTC (rev 3350)
+++ branches/SAMBA_4_0/source/ntvfs/posix/pvfs_resolve.c	2004-10-29 04:43:28 UTC (rev 3351)
@@ -510,8 +510,14 @@
 		inode = name->st.st_ino;
 	}
 
-	if (fstat(fd, &name->st) == -1) {
-		return NT_STATUS_INVALID_HANDLE;
+	if (name->dos.attrib & FILE_ATTRIBUTE_DIRECTORY) {
+		if (stat(name->full_name, &name->st) == -1) {
+			return NT_STATUS_INVALID_HANDLE;
+		}
+	} else {
+		if (fstat(fd, &name->st) == -1) {
+			return NT_STATUS_INVALID_HANDLE;
+		}
 	}
 
 	if (name->exists &&

Modified: branches/SAMBA_4_0/source/ntvfs/posix/pvfs_setfileinfo.c
===================================================================
--- branches/SAMBA_4_0/source/ntvfs/posix/pvfs_setfileinfo.c	2004-10-29 03:48:49 UTC (rev 3350)
+++ branches/SAMBA_4_0/source/ntvfs/posix/pvfs_setfileinfo.c	2004-10-29 04:43:28 UTC (rev 3351)
@@ -128,6 +128,9 @@
 
 	/* possibly change the file size */
 	if (newstats.st.st_size != f->name->st.st_size) {
+		if (f->name->dos.attrib & FILE_ATTRIBUTE_DIRECTORY) {
+			return NT_STATUS_FILE_IS_A_DIRECTORY;
+		}
 		if (ftruncate(f->fd, newstats.st.st_size) == -1) {
 			return pvfs_map_errno(pvfs, errno);
 		}
@@ -150,6 +153,10 @@
 	/* possibly change the attribute */
 	if (newstats.dos.attrib != f->name->dos.attrib) {
 		mode_t mode = pvfs_fileperms(pvfs, newstats.dos.attrib);
+		if (f->name->dos.attrib & FILE_ATTRIBUTE_DIRECTORY) {
+			/* ignore on directories for now */
+			return NT_STATUS_OK;
+		}
 		if (fchmod(f->fd, mode) == -1) {
 			return pvfs_map_errno(pvfs, errno);
 		}



More information about the samba-cvs mailing list