vfs_error_inject: implement SMB_VFS_OPENAT()
authorRalph Boehme <slow@samba.org>
Wed, 20 May 2020 21:02:06 +0000 (23:02 +0200)
committerJeremy Allison <jra@samba.org>
Thu, 21 May 2020 20:38:32 +0000 (20:38 +0000)
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/modules/vfs_error_inject.c
source3/script/tests/test_open_eintr.sh

index c7a99370b2a5ce3ccb08fe99283551fa75645034..c67b622fbe6037e69e063d9d470f11171e03fdbf 100644 (file)
@@ -122,10 +122,26 @@ static int vfs_error_inject_open(
        return SMB_VFS_NEXT_OPEN(handle, smb_fname, fsp, flags, mode);
 }
 
+static int vfs_error_inject_openat(struct vfs_handle_struct *handle,
+                                  const struct files_struct *dirfsp,
+                                  const struct smb_filename *smb_fname,
+                                  files_struct *fsp,
+                                  int flags,
+                                  mode_t mode)
+{
+       int error = inject_unix_error("openat", handle);
+       if (error != 0) {
+               errno = error;
+               return -1;
+       }
+       return SMB_VFS_NEXT_OPENAT(handle, dirfsp, smb_fname, fsp, flags, mode);
+}
+
 static struct vfs_fn_pointers vfs_error_inject_fns = {
        .chdir_fn = vfs_error_inject_chdir,
        .pwrite_fn = vfs_error_inject_pwrite,
        .open_fn = vfs_error_inject_open,
+       .openat_fn = vfs_error_inject_openat,
 };
 
 static_decl_vfs;
index d08f7fcfc23b6c418da9c469ae4860bfa050fe44..8a92744a85c50d5a575437393d1b851dd0c58b37 100755 (executable)
@@ -42,6 +42,7 @@ head -n 1 <&101
 head -n 1 <&102
 
 echo "error_inject:open = EINTR" > ${error_inject_conf}
+echo "error_inject:openat = EINTR" >> ${error_inject_conf}
 ${SMBCONTROL} ${CONF} 0 reload-config
 
 sleep 1