summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2010-09-17 15:08:29 -0600
committerEric Blake <eblake@redhat.com>2010-09-17 15:08:44 -0600
commit89b0db35db10a8beccaf83909c7f62f127fb5821 (patch)
tree716c39ed6294c0c0765d130b8ab01fcfabf89bd8 /tests
parent025fae6d61b82020179feb5c72d3747f1ce351c4 (diff)
downloadgnulib-89b0db35db10a8beccaf83909c7f62f127fb5821.tar.gz
fdutimens, fdutimensat: update signature, again
In general, merging: f<act>(fd,args) and <act>at(dir,name,args) should produce: fd<act>at(fd,dir,name,args) * lib/utimens.h (gl_futimens): Delete, and move signature... (fdutimens): ...here. (fdutimensat): Rearrange signature. (lutimensat): Rename variable for clarity. * lib/fdutimensat.c (fdutimensat): Update signature. * lib/utimens.c (fdutimens): Likewise. (gl_futimens): Delete. (utimens, lutimens): Update callers. * lib/futimens.c (futimens): Likewise. * tests/test-fdutimensat.c: Likewise. * tests/test-utimens.c: Likewise. * tests/test-futimens.h: Update comment. * NEWS: Mention this. Suggested by Paul Eggert. Signed-off-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/test-fdutimensat.c16
-rw-r--r--tests/test-futimens.h2
-rw-r--r--tests/test-utimens.c6
3 files changed, 12 insertions, 12 deletions
diff --git a/tests/test-fdutimensat.c b/tests/test-fdutimensat.c
index 80eb373d00..d94667af91 100644
--- a/tests/test-fdutimensat.c
+++ b/tests/test-fdutimensat.c
@@ -40,7 +40,7 @@ static int dfd = AT_FDCWD;
static int
do_futimens (int fd, struct timespec const times[2])
{
- return fdutimensat (dfd, NULL, fd, times, 0);
+ return fdutimensat (fd, dfd, NULL, times, 0);
}
/* Test the use of file descriptors alongside a name. */
@@ -52,8 +52,8 @@ do_fdutimens (char const *name, struct timespec const times[2])
if (fd < 0)
fd = openat (dfd, name, O_RDONLY);
errno = 0;
- result = fdutimensat (dfd, name, fd, times, 0);
- ASSERT (fdutimensat (dfd, name, fd, times, AT_SYMLINK_NOFOLLOW) == result);
+ result = fdutimensat (fd, dfd, name, times, 0);
+ ASSERT (fdutimensat (fd, dfd, name, times, AT_SYMLINK_NOFOLLOW) == result);
if (0 <= fd)
{
int saved_errno = errno;
@@ -74,14 +74,14 @@ do_lutimens (const char *name, struct timespec const times[2])
static int
do_lutimens1 (const char *name, struct timespec const times[2])
{
- return fdutimensat (dfd, name, -1, times, AT_SYMLINK_NOFOLLOW);
+ return fdutimensat (-1, dfd, name, times, AT_SYMLINK_NOFOLLOW);
}
/* Wrap fdutimensat to behave like utimens. */
static int
do_utimens (const char *name, struct timespec const times[2])
{
- return fdutimensat (dfd, name, -1, times, 0);
+ return fdutimensat (-1, dfd, name, times, 0);
}
int
@@ -117,12 +117,12 @@ main (void)
fd = creat ("file", 0600);
ASSERT (0 <= fd);
errno = 0;
- ASSERT (fdutimensat (fd, ".", AT_FDCWD, NULL, 0) == -1);
+ ASSERT (fdutimensat (AT_FDCWD, fd, ".", NULL, 0) == -1);
ASSERT (errno == ENOTDIR);
{
struct timespec ts[2] = { { Y2K, 0 }, { Y2K, 0 } };
struct stat st;
- ASSERT (fdutimensat (dfd, BASE "dir/file", fd, ts, 0) == 0);
+ ASSERT (fdutimensat (fd, dfd, BASE "dir/file", ts, 0) == 0);
ASSERT (stat ("file", &st) == 0);
ASSERT (st.st_atime == Y2K);
ASSERT (get_stat_atime_ns (&st) == 0);
@@ -132,7 +132,7 @@ main (void)
ASSERT (close (fd) == 0);
ASSERT (close (dfd) == 0);
errno = 0;
- ASSERT (fdutimensat (dfd, ".", -1, NULL, 0) == -1);
+ ASSERT (fdutimensat (-1, dfd, ".", NULL, 0) == -1);
ASSERT (errno == EBADF);
/* Cleanup. */
diff --git a/tests/test-futimens.h b/tests/test-futimens.h
index 97c7acddcb..ab86ae2171 100644
--- a/tests/test-futimens.h
+++ b/tests/test-futimens.h
@@ -16,7 +16,7 @@
#include "test-utimens-common.h"
-/* This file is designed to test both gl_futimens(a,NULL,b) and
+/* This file is designed to test both fdutimens(a,NULL,b) and
futimens(a,b). FUNC is the function to test. Assumes that BASE
and ASSERT are already defined. If PRINT, warn before skipping
tests with status 77. */
diff --git a/tests/test-utimens.c b/tests/test-utimens.c
index f2a31a88ed..09c353b015 100644
--- a/tests/test-utimens.c
+++ b/tests/test-utimens.c
@@ -33,11 +33,11 @@
#include "test-lutimens.h"
#include "test-utimens.h"
-/* Wrap gl_futimens to behave like futimens. */
+/* Wrap fdutimens to behave like futimens. */
static int
do_futimens (int fd, struct timespec const times[2])
{
- return gl_futimens (fd, NULL, times);
+ return fdutimens (fd, NULL, times);
}
/* Test the use of file descriptors alongside a name. */
@@ -49,7 +49,7 @@ do_fdutimens (char const *name, struct timespec const times[2])
if (fd < 0)
fd = open (name, O_RDONLY);
errno = 0;
- result = fdutimens (name, fd, times);
+ result = fdutimens (fd, name, times);
if (0 <= fd)
{
int saved_errno = errno;