Fix missing futimens bug.

This commit is contained in:
Richard Jones
2009-05-06 15:29:01 +01:00
parent 459da0831c
commit bb98bbb91c
3 changed files with 12 additions and 1 deletions

2
BUGS
View File

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

View File

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

View File

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