If utimensat(2) is not defined on the platform we switch to using utimes(2).
Signed-off-by: Stanislav Kholmanskikh <[email protected]> --- lib/safe_file_ops.c | 14 +++++++++++++- 1 files changed, 13 insertions(+), 1 deletions(-) diff --git a/lib/safe_file_ops.c b/lib/safe_file_ops.c index 8cfd264..3876c27 100644 --- a/lib/safe_file_ops.c +++ b/lib/safe_file_ops.c @@ -21,10 +21,12 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#include "config.h" #include <stdarg.h> #include <stdio.h> #include <sys/types.h> #include <sys/stat.h> +#include <sys/syscall.h> #include <fcntl.h> #include "safe_file_ops.h" @@ -186,10 +188,20 @@ void safe_touch(const char *file, const int lineno, pathname, file, lineno); } + +#if HAVE_UTIMENSAT ret = utimensat(AT_FDCWD, pathname, times, 0); +#else + /* we can't reliably check if times[i].tv_nsec is + * either UTIME_NOW or UTIME_OMIT (because they + * are not defined if utimensat() is not defined), + * therefore update the access/modification times + * to the current time */ + ret = utimes(pathname, NULL); +#endif if (ret == -1) tst_brkm(TBROK | TERRNO, cleanup_fn, - "Failed to do utimensat() on file '%s' at %s:%d", + "Failed to update the access/modification times on file '%s' at %s:%d", pathname, file, lineno); } -- 1.7.1 ------------------------------------------------------------------------------ DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access Free app hosting. Or install the open source package on any LAMP server. Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native! http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
