vfs_error_inject: add pwrite
authorRalph Boehme <slow@samba.org>
Fri, 23 Nov 2018 09:07:29 +0000 (10:07 +0100)
committerRalph Boehme <slow@samba.org>
Tue, 27 Nov 2018 06:13:12 +0000 (07:13 +0100)
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13688

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/modules/vfs_error_inject.c

index bb5477a449f0509a8b152d29e2a65c5ef77da2e0..9f0a25fb73f15c103445d0a8c820c4c8fdd9f839 100644 (file)
@@ -88,8 +88,26 @@ static int vfs_error_inject_chdir(vfs_handle_struct *handle,
        return SMB_VFS_NEXT_CHDIR(handle, smb_fname);
 }
 
+static ssize_t vfs_error_inject_pwrite(vfs_handle_struct *handle,
+                                      files_struct *fsp,
+                                      const void *data,
+                                      size_t n,
+                                      off_t offset)
+{
+       int error;
+
+       error = inject_unix_error("pwrite", handle);
+       if (error != 0) {
+               errno = error;
+               return -1;
+       }
+
+       return SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, offset);
+}
+
 static struct vfs_fn_pointers vfs_error_inject_fns = {
        .chdir_fn = vfs_error_inject_chdir,
+       .pwrite_fn = vfs_error_inject_pwrite,
 };
 
 static_decl_vfs;