summaryrefslogtreecommitdiff
path: root/libdiskfs
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1997-02-14 01:19:23 +0000
committerMiles Bader <miles@gnu.org>1997-02-14 01:19:23 +0000
commit5fe269f922f2b2c5f43714927ce2de8c03e143bf (patch)
treec68143fa6812f61ba5e876557adac4622239b98e /libdiskfs
parent589ce62d84d27e21e73cb675dec7c0e19a945f82 (diff)
(diskfs_S_dir_rename):
Return EXDEV if FROMCRED and TOCRED are in different shadow trees. Don't pass depth args to diskfs_lookup.
Diffstat (limited to 'libdiskfs')
-rw-r--r--libdiskfs/dir-rename.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/libdiskfs/dir-rename.c b/libdiskfs/dir-rename.c
index 5c15a1cc..6fc7e0f5 100644
--- a/libdiskfs/dir-rename.c
+++ b/libdiskfs/dir-rename.c
@@ -39,7 +39,11 @@ diskfs_S_dir_rename (struct protid *fromcred,
return EOPNOTSUPP;
/* Verify that tocred really is a port to us. */
- if (!tocred)
+ if (! tocred)
+ return EXDEV;
+
+ if (tocred->po->shadow_root != fromcred->po->shadow_root)
+ /* Same translator, but in different shadow trees. */
return EXDEV;
if (diskfs_check_readonly ())
@@ -53,8 +57,7 @@ diskfs_S_dir_rename (struct protid *fromcred,
will prevent anyone from deleting it before we create
the new link. */
mutex_lock (&fdp->lock);
- err = diskfs_lookup (fdp, fromname, LOOKUP, &fnp, 0, fromcred,
- fromcred->po->depth, 0);
+ err = diskfs_lookup (fdp, fromname, LOOKUP, &fnp, 0, fromcred);
mutex_unlock (&fdp->lock);
if (err == EAGAIN)
err = EINVAL;
@@ -102,8 +105,7 @@ diskfs_S_dir_rename (struct protid *fromcred,
/* Link the node into the new directory. */
mutex_lock (&tdp->lock);
- err = diskfs_lookup (tdp, toname, RENAME, &tnp, ds, tocred,
- tocred->po->depth, 0);
+ err = diskfs_lookup (tdp, toname, RENAME, &tnp, ds, tocred);
if (err == EAGAIN)
err = EINVAL;
else if (!err && excl)
@@ -186,8 +188,7 @@ diskfs_S_dir_rename (struct protid *fromcred,
fdp locked (nor could we), so someone else might have already
removed it. */
mutex_lock (&fdp->lock);
- err = diskfs_lookup (fdp, fromname, REMOVE, &tmpnp, ds, fromcred,
- fromcred->po->depth, 0);
+ err = diskfs_lookup (fdp, fromname, REMOVE, &tmpnp, ds, fromcred);
if (err)
{
diskfs_drop_dirstat (tdp, ds);