Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 84485
b: refs/heads/master
c: f6aa7f2
h: refs/heads/master
i:
  84483: 9468d4c
v: v3
  • Loading branch information
Christoph Hellwig authored and Lachlan McIlroy committed Feb 7, 2008
1 parent 46a0089 commit 74f4eda
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 35fec8df65217546f6d9d508b203c1d135a67fbc
refs/heads/master: f6aa7f2184330262e1cb5f7802536e5346bd46a3
20 changes: 11 additions & 9 deletions trunk/fs/xfs/xfs_dfrag.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,23 @@ xfs_swapext(
goto out_free_sxp;
}

if (!(file->f_mode & FMODE_WRITE) || (file->f_flags & O_APPEND)) {
error = XFS_ERROR(EBADF);
goto out_put_file;
}

target_file = fget((int)sxp->sx_fdtmp);
if (!target_file) {
error = XFS_ERROR(EINVAL);
goto out_put_file;
}

if (!(target_file->f_mode & FMODE_WRITE) ||
(target_file->f_flags & O_APPEND)) {
error = XFS_ERROR(EBADF);
goto out_put_target_file;
}

ip = XFS_I(file->f_path.dentry->d_inode);
tip = XFS_I(target_file->f_path.dentry->d_inode);

Expand Down Expand Up @@ -154,15 +165,6 @@ xfs_swap_extents(
xfs_lock_inodes(ips, 2, 0, lock_flags);
locked = 1;

/* Check permissions */
error = xfs_iaccess(ip, S_IWUSR, NULL);
if (error)
goto error0;

error = xfs_iaccess(tip, S_IWUSR, NULL);
if (error)
goto error0;

/* Verify that both files have the same format */
if ((ip->i_d.di_mode & S_IFMT) != (tip->i_d.di_mode & S_IFMT)) {
error = XFS_ERROR(EINVAL);
Expand Down

0 comments on commit 74f4eda

Please sign in to comment.