diff options
author | Nick Mathewson <nickm@torproject.org> | 2005-09-14 23:27:52 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2005-09-14 23:27:52 +0000 |
commit | 6973ef9be449dc3a28c6f2e30ebd08ade447d3d6 (patch) | |
tree | 8461d308f0956eb799baef34e859f904bf9ea1e3 /src/common/compat.c | |
parent | bc0af7046a2d1025a1d7d5c54698841b1a8bee5b (diff) | |
download | tor-6973ef9be449dc3a28c6f2e30ebd08ade447d3d6.tar tor-6973ef9be449dc3a28c6f2e30ebd08ade447d3d6.tar.gz |
Add a touch_file() function to compat so we can update cache mtimes.
svn:r5067
Diffstat (limited to 'src/common/compat.c')
-rw-r--r-- | src/common/compat.c | 15 |
1 files changed, 15 insertions, 0 deletions
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 <pthread.h> #endif +#ifdef HAVE_UTIME_H +#include <utime.h> +#endif +#ifdef HAVE_SYS_UTIME_H +#include <sys/utime.h> +#endif #include "log.h" #include "util.h" @@ -269,6 +275,15 @@ replace_file(const char *from, const char *to) #endif } +/** Change <b>fname</b>'s modification time to now. */ +int +touch_file(const char *fname) +{ + if (utime(fname, NULL)!=0) + return -1; + return 0; +} + /** Turn <b>socket</b> into a nonblocking socket. */ void |