r3083: fixed a couple of generic mapping errors found with RAW-* and cifs:mapgeneric
authorAndrew Tridgell <tridge@samba.org>
Wed, 20 Oct 2004 11:10:51 +0000 (11:10 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:01:57 +0000 (13:01 -0500)
(This used to be commit 76329798ff7f804bf4d7e6e9c1bb4c4dc7b9bb01)

source4/ntvfs/ntvfs_generic.c

index b6f3d8e603982c73dad929ac5513e00c31ced0c8..d4c163844ffaec60554597a4b5a202d0993a9718 100644 (file)
@@ -773,7 +773,8 @@ NTSTATUS ntvfs_map_write(struct smbsrv_request *req, union smb_write *wr,
 
                wr->writeunlock.out.nwritten = wr2->generic.out.nwritten;
 
-               if (NT_STATUS_IS_OK(status)) {
+               if (NT_STATUS_IS_OK(status) && 
+                   lck->unlock.in.count != 0) {
                        status = ntvfs->ops->lock(ntvfs, req, lck);
                }
                break;
@@ -798,7 +799,8 @@ NTSTATUS ntvfs_map_write(struct smbsrv_request *req, union smb_write *wr,
                status = ntvfs->ops->write(ntvfs, req, wr2);
                wr->writeclose.out.nwritten    = wr2->generic.out.nwritten;
 
-               if (NT_STATUS_IS_OK(status)) {
+               if (NT_STATUS_IS_OK(status) &&
+                   wr2->generic.in.count != 0) {
                        status = ntvfs->ops->close(ntvfs, req, cl);
                }
                break;