/* Test of rename() function.
- Copyright (C) 2009-2016 Free Software Foundation, Inc.
+ Copyright (C) 2009-2021 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* This file is designed to test both rename(a,b) and
renameat(AT_FDCWD,a,AT_FDCWD,b). FUNC is the function to test.
errno = 0;
ASSERT (func (BASE "dir2", BASE "dir/.") == -1);
ASSERT (errno == EINVAL || errno == EBUSY || errno == EISDIR
- || errno == ENOTEMPTY || errno == EEXIST);
+ || errno == ENOTEMPTY || errno == EEXIST
+ || errno == ENOENT /* WSL */);
}
{
errno = 0;
ASSERT (func (BASE "dir2/.", BASE "dir") == -1);
- ASSERT (errno == EINVAL || errno == EBUSY || errno == EEXIST);
+ ASSERT (errno == EINVAL || errno == EBUSY || errno == EEXIST
+ || errno == ENOENT /* WSL */);
}
ASSERT (rmdir (BASE "dir") == 0);
/* Files present here:
errno = 0;
ASSERT (func (BASE "dir2", BASE "dir/.//") == -1);
ASSERT (errno == EINVAL || errno == EBUSY || errno == EISDIR
- || errno == ENOTEMPTY || errno == EEXIST);
+ || errno == ENOTEMPTY || errno == EEXIST
+ || errno == ENOENT /* WSL */);
}
{
errno = 0;
ASSERT (func (BASE "dir2/.//", BASE "dir") == -1);
- ASSERT (errno == EINVAL || errno == EBUSY || errno == EEXIST);
+ ASSERT (errno == EINVAL || errno == EBUSY || errno == EEXIST
+ || errno == ENOENT /* WSL */);
}
ASSERT (rmdir (BASE "dir2") == 0);
/* Files present here:
{ /* File onto hard link. */
ASSERT (func (BASE "file", BASE "file2") == 0);
memset (&st, 0, sizeof st);
- ASSERT (stat (BASE "file", &st) == 0);
+ if (stat (BASE "file", &st) != 0)
+ {
+ /* This can happen on NetBSD. */
+ ASSERT (errno == ENOENT);
+ ASSERT (link (BASE "file2", BASE "file") == 0);
+ ASSERT (stat (BASE "file", &st) == 0);
+ }
ASSERT (st.st_size == 2);
memset (&st, 0, sizeof st);
ASSERT (stat (BASE "file2", &st) == 0);