From 3346754d91ba27616e7f50dc7ce32a0e1751a0d1 Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Wed, 24 Jun 2009 22:39:03 +0000 Subject: [PATCH] lib/utimens.c (fdutimens, lutimens): Workaround OpenVZ kernel bug #970 http://bugzilla.openvz.org/show_bug.cgi?id=970 diff --git a/lib/utimens.c b/lib/utimens.c index f6c4fe34c..b45cb1b8a 100644 --- a/lib/utimens.c +++ b/lib/utimens.c @@ -253,9 +253,11 @@ fdutimens (int fd, char const *file, struct timespec const timespec[2]) https://bugzilla.redhat.com/show_bug.cgi?id=449910 It appears that utimensat can mistakenly return 280 rather than -1 upon ENOSYS failure. + Also, Work around an OpenVZ kernel bug: + http://bugzilla.openvz.org/show_bug.cgi?id=970 FIXME: remove in 2010 or whenever the offending kernels are no longer in common use. */ - if (0 < result) + if (0 < result || (result < 0 && errno == EFAULT)) errno = ENOSYS; # endif /* __linux__ */ if (result == 0 || errno != ENOSYS) @@ -271,7 +273,7 @@ fdutimens (int fd, char const *file, struct timespec const timespec[2]) result = futimens (fd, ts); # ifdef __linux__ /* Work around the same bug as above. */ - if (0 < result) + if (0 < result || (result < 0 && errno == EFAULT)) errno = ENOSYS; # endif /* __linux__ */ if (result == 0 || errno != ENOSYS) @@ -571,7 +573,7 @@ lutimens (char const *file, struct timespec const timespec[2]) than -1 upon ENOSYS failure. FIXME: remove in 2010 or whenever the offending kernels are no longer in common use. */ - if (0 < result) + if (0 < result || (result < 0 && errno == EFAULT)) errno = ENOSYS; # endif if (result == 0 || errno != ENOSYS)