fixed error code for write on a directory
[kai/samba.git] / source4 / ntvfs / posix / pvfs_write.c
index d433a80cc6426f54f4d6517a24687b22f5c3fc60..1f662f13fcdab52618bb4c5f07d8357dc9c57ef2 100644 (file)
@@ -7,7 +7,7 @@
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
@@ -16,8 +16,7 @@
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #include "includes.h"
@@ -46,7 +45,7 @@ NTSTATUS pvfs_write(struct ntvfs_module_context *ntvfs,
        }
 
        if (f->handle->fd == -1) {
-               return NT_STATUS_FILE_IS_A_DIRECTORY;
+               return NT_STATUS_INVALID_DEVICE_REQUEST;
        }
 
        if (!(f->access_mask & (SEC_FILE_WRITE_DATA | SEC_FILE_APPEND_DATA))) {
@@ -58,7 +57,10 @@ NTSTATUS pvfs_write(struct ntvfs_module_context *ntvfs,
                                 wr->writex.in.count,
                                 WRITE_LOCK);
        NT_STATUS_NOT_OK_RETURN(status);
-       
+
+       status = pvfs_break_level2_oplocks(f);
+       NT_STATUS_NOT_OK_RETURN(status);
+
        if (f->handle->name->stream_name) {
                ret = pvfs_stream_write(pvfs,
                                        f->handle,