From: Miklos Szeredi Date: Wed, 16 Apr 2014 00:19:02 +0000 (+1000) Subject: renameat2 syscall: turn EEXIST into ENOTEMPTY X-Git-Tag: v2022.05.01~3170 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=cd444c6591df7cc1dd2989b81259c9e9e6744613;p=xfstests-dev.git renameat2 syscall: turn EEXIST into ENOTEMPTY 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 Reviewed-by: Dave Chinner Signed-off-by: Dave Chinner --- diff --git a/src/renameat2.c b/src/renameat2.c index 2980f14f..5ac09362 100644 --- a/src/renameat2.c +++ b/src/renameat2.c @@ -92,6 +92,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; }