xfs
[Top] [All Lists]

[xfstests PATCH] renameat2 syscall: turn EEXIST into ENOTEMPTY

To: xfs@xxxxxxxxxxx
Subject: [xfstests PATCH] renameat2 syscall: turn EEXIST into ENOTEMPTY
From: Miklos Szeredi <miklos@xxxxxxxxxx>
Date: Mon, 14 Apr 2014 12:49:53 +0200
Delivered-to: xfs@xxxxxxxxxxx
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szeredi.hu; s=google; h=date:from:to:subject:message-id:mime-version:content-type :content-disposition:user-agent; bh=/NNMo4NbB7JhwwV+O1LhmXNQ1P5OVTG/FCU/r8vxOUo=; b=JLo/WDW7NNUbvyU9aoAqX+JDa8feDuxoKXASIEi0RtzRegYc5DtJ3cA4Yez/QKjeBg gZL6tjTqrVZSodHcO45ilirpu8hlECfqaM+34iu6UpIqLTS1It7/vs69r3deOUliokml UIh7hPTUNgNyYblEFlYbH9mtj6mdH5T6XBSBI=
User-agent: Mutt/1.5.21 (2010-09-15)
From: Miklos Szeredi <mszeredi@xxxxxxx>

XFS is returning EEXIST rather than ENOTEMPTY for several of
these rename tests. The rename man page says this about the errors:

       ENOTEMPTY or EEXIST
              newpath is a nonempty directory, that is, contains
              entries other than "." and "..".

Which implies that both errors are valid and so the test should pass
in either case.

Signed-off-by: Miklos Szeredi <mszeredi@xxxxxxx>
---
 src/renameat2.c |    9 +++++++++
 1 file changed, 9 insertions(+)

--- a/src/renameat2.c
+++ b/src/renameat2.c
@@ -88,6 +88,15 @@ int main(int argc, char *argv[])
                        else
                                return 0;
                }
+               /*
+                * Turn EEXIST into ENOTEMPTY.  E.g. XFS uses EEXIST, and that
+                * is also accepted by the standards.
+                *
+                * This applies only to plain rename (flags == 0).
+                */
+               if (!flags && errno == EEXIST)
+                       errno = ENOTEMPTY;
+
                perror("");
                return 1;
        }

<Prev in Thread] Current Thread [Next in Thread>