VFS: Modify chmod to take a const struct smb_filename * instead of const char *
[samba.git] / source3 / torture / cmd_vfs.c
index 0bc6dbcd5ac2ef47834f81471d0a36cf2a766d85..3e6371407f549a40c97acbf3dd9530bbfad63f98 100644 (file)
@@ -837,6 +837,7 @@ static NTSTATUS cmd_lstat(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc,
 
 static NTSTATUS cmd_chmod(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, const char **argv)
 {
+       struct smb_filename *smb_fname = NULL;
        mode_t mode;
        if (argc != 3) {
                printf("Usage: chmod <path> <mode>\n");
@@ -844,7 +845,16 @@ static NTSTATUS cmd_chmod(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc,
        }
 
        mode = atoi(argv[2]);
-       if (SMB_VFS_CHMOD(vfs->conn, argv[1], mode) == -1) {
+
+       smb_fname = synthetic_smb_fname(talloc_tos(),
+                                       argv[1],
+                                       NULL,
+                                       NULL);
+       if (smb_fname == NULL) {
+               return NT_STATUS_NO_MEMORY;
+       }
+
+       if (SMB_VFS_CHMOD(vfs->conn, smb_fname, mode) == -1) {
                printf("chmod: error=%d (%s)\n", errno, strerror(errno));
                return NT_STATUS_UNSUCCESSFUL;
        }