From 6973ef9be449dc3a28c6f2e30ebd08ade447d3d6 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Wed, 14 Sep 2005 23:27:52 +0000 Subject: Add a touch_file() function to compat so we can update cache mtimes. svn:r5067 --- src/common/compat.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/common/compat.c') diff --git a/src/common/compat.c b/src/common/compat.c index 39b8f953f..3718123a7 100644 --- a/src/common/compat.c +++ b/src/common/compat.c @@ -80,6 +80,12 @@ const char compat_c_id[] = "$Id$"; #ifdef HAVE_PTHREAD_H #include #endif +#ifdef HAVE_UTIME_H +#include +#endif +#ifdef HAVE_SYS_UTIME_H +#include +#endif #include "log.h" #include "util.h" @@ -269,6 +275,15 @@ replace_file(const char *from, const char *to) #endif } +/** Change fname's modification time to now. */ +int +touch_file(const char *fname) +{ + if (utime(fname, NULL)!=0) + return -1; + return 0; +} + /** Turn socket into a nonblocking socket. */ void -- cgit v1.2.3