From: Richard Jones Date: Wed, 6 May 2009 14:29:01 +0000 (+0100) Subject: Fix missing futimens bug. X-Git-Tag: 1.0.19~12 X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=bb98bbb91c74cca47b5e1f79fd54f4024572fd22;p=libguestfs.git Fix missing futimens bug. --- diff --git a/BUGS b/BUGS index aa00478..e1ce2de 100644 --- a/BUGS +++ b/BUGS @@ -33,9 +33,11 @@ Try using tgz-out on a very large directory. [libguestfs] futimens (do_touch) not available in glibc 2.5 (reported by Charles Duffy) +[fixed] [ocaml] Does not compile with OCaml 3.09.3 from RHEL 5 (reported by Charles Duffy) +[fixed] [inspector] If there are missing Perl module deps, it still configures the inspector. (eg. if perl-Sys-Virt is missing). diff --git a/daemon/configure.ac b/daemon/configure.ac index f78b308..6cf4c0f 100644 --- a/daemon/configure.ac +++ b/daemon/configure.ac @@ -59,6 +59,9 @@ AC_CHECK_LIB([portablexdr],[xdrmem_create],[],[ AC_SEARCH_LIBS([xdrmem_create],[rpc xdr nsl]) ]) +dnl Functions which may not be available in older distributions. +AC_CHECK_FUNCS([futimens]) + dnl Produce output files. AC_CONFIG_HEADERS([config.h]) AC_CONFIG_FILES([Makefile]) diff --git a/daemon/file.c b/daemon/file.c index f910b94..8847d26 100644 --- a/daemon/file.c +++ b/daemon/file.c @@ -33,6 +33,7 @@ int do_touch (const char *path) { int fd; + int r; NEED_ROOT (-1); ABS_PATH (path, -1); @@ -46,7 +47,12 @@ do_touch (const char *path) return -1; } - if (futimens (fd, NULL) == -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); return -1;