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.
This commit is contained in:
Richard Jones
2009-11-25 12:17:10 +00:00
parent 25081d6268
commit b3035e8d7c
5 changed files with 10 additions and 11 deletions

8
daemon/.gitignore vendored
View File

@@ -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

View File

@@ -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 \

View File

@@ -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);

View File

@@ -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

View File

@@ -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 */
}