bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[committed hurd 1/2] libdiskfs: fix renaming of directories


From: Justus Winter
Subject: [committed hurd 1/2] libdiskfs: fix renaming of directories
Date: Tue, 19 May 2015 19:52:30 +0200

Previously, file permissions and ownership of the target directory
were ignored when renaming a directory:

    % mkdir a b
    % chmod 555 a
    % mv b a
    % ls a
    b

* libdiskfs/dir-renamed.c (diskfs_rename_dir): Fix error handling.
---
 libdiskfs/dir-renamed.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libdiskfs/dir-renamed.c b/libdiskfs/dir-renamed.c
index 9e37e23..a4878f3 100644
--- a/libdiskfs/dir-renamed.c
+++ b/libdiskfs/dir-renamed.c
@@ -94,6 +94,8 @@ diskfs_rename_dir (struct node *fdp, struct node *fnp, const 
char *fromname,
   ds = buf;
   err = diskfs_lookup (tdp, toname, RENAME, &tnp, ds, tocred);
   assert (err != EAGAIN);      /* <-> assert (TONAME != "..") */
+  if (err && err != ENOENT)
+    goto out;
 
   if (tnp == fnp)
     {
-- 
2.1.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]