From b3035e8d7c04a71d9a54ab7e52bc9e169ecf0b47 Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Wed, 25 Nov 2009 12:17:10 +0000 Subject: [PATCH] daemon: Use gnulib futimens module. Instead of checking for futimens support and falling back (incorrectly in one case) to using futimes, use gnulib's module. However the gnulib module does not yet support Win32, so this change is only really useful on platforms like RHEL 5. --- daemon/.gitignore | 8 ++++++++ daemon/configure.ac | 1 - daemon/file.c | 4 ---- daemon/m4/gnulib-cache.m4 | 3 ++- daemon/utimens.c | 5 ----- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/daemon/.gitignore b/daemon/.gitignore index d66fb9f..9168142 100644 --- a/daemon/.gitignore +++ b/daemon/.gitignore @@ -7,6 +7,7 @@ m4/arpa_inet_h.m4 m4/canonicalize-lgpl.m4 m4/chdir-long.m4 m4/chown.m4 +m4/clock_time.m4 m4/close.m4 m4/codeset.m4 m4/d-ino.m4 @@ -29,6 +30,7 @@ m4/fcntl_h.m4 m4/fdopendir.m4 m4/float_h.m4 m4/fnmatch.m4 +m4/futimens.m4 m4/getcwd-abort-bug.m4 m4/getcwd-path-max.m4 m4/getcwd.m4 @@ -36,6 +38,7 @@ m4/getdelim.m4 m4/getgroups.m4 m4/getline.m4 m4/getlogin_r.m4 +m4/gettime.m4 m4/gettimeofday.m4 m4/getpagesize.m4 m4/getugroups.m4 @@ -118,11 +121,16 @@ m4/sys_time_h.m4 m4/sys_wait_h.m4 m4/tempname.m4 m4/time_h.m4 +m4/timespec.m4 m4/unistd-safer.m4 m4/unistd_h.m4 m4/unlink.m4 m4/unlinkdir.m4 m4/usleep.m4 +m4/utimbuf.m4 +m4/utimecmp.m4 +m4/utimens.m4 +m4/utimes.m4 m4/vasnprintf.m4 m4/vasprintf.m4 m4/warnings.m4 diff --git a/daemon/configure.ac b/daemon/configure.ac index d1a9b0f..c7025dd 100644 --- a/daemon/configure.ac +++ b/daemon/configure.ac @@ -170,7 +170,6 @@ AC_CHECK_LIB([portablexdr],[xdrmem_create],[],[ dnl Functions which may not be available in older distributions. AC_CHECK_FUNCS([\ - futimens \ getxattr \ inotify_init1 \ lgetxattr \ diff --git a/daemon/file.c b/daemon/file.c index 252c02c..0b50eeb 100644 --- a/daemon/file.c +++ b/daemon/file.c @@ -44,11 +44,7 @@ do_touch (const char *path) return -1; } -#ifdef HAVE_FUTIMENS r = futimens (fd, NULL); -#else - r = futimes (fd, NULL); -#endif if (r == -1) { reply_with_perror ("futimens: %s", path); close (fd); diff --git a/daemon/m4/gnulib-cache.m4 b/daemon/m4/gnulib-cache.m4 index edb8a07..2b63258 100644 --- a/daemon/m4/gnulib-cache.m4 +++ b/daemon/m4/gnulib-cache.m4 @@ -15,12 +15,13 @@ # Specification in the form of a command-line invocation: -# gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --with-tests --no-libtool --macro-prefix=gl c-ctype getline glob hash ignore-value manywarnings mkdtemp netdb openat readlink select sleep strchrnul strndup sys_select sys_wait vasprintf warnings +# gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --with-tests --no-libtool --macro-prefix=gl c-ctype futimens getline glob hash ignore-value manywarnings mkdtemp netdb openat readlink select sleep strchrnul strndup sys_select sys_wait vasprintf warnings # Specification in the form of a few gnulib-tool.m4 macro invocations: gl_LOCAL_DIR([]) gl_MODULES([ c-ctype + futimens getline glob hash diff --git a/daemon/utimens.c b/daemon/utimens.c index 2d0e3bf..e836b4e 100644 --- a/daemon/utimens.c +++ b/daemon/utimens.c @@ -33,10 +33,6 @@ do_utimens (const char *path, int64_t atsecs, int64_t atnsecs, int64_t mtsecs, int64_t mtnsecs) { -#ifndef HAVE_FUTIMENS - reply_with_error ("utimens: not supported in this appliance"); - return -1; -#else int fd; int r; @@ -77,5 +73,4 @@ do_utimens (const char *path, } return 0; -#endif /* HAVE_FUTIMENS */ } -- 1.8.3.1