aboutsummaryrefslogtreecommitdiff
path: root/src/common/compat.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2005-09-14 23:27:52 +0000
committerNick Mathewson <nickm@torproject.org>2005-09-14 23:27:52 +0000
commit6973ef9be449dc3a28c6f2e30ebd08ade447d3d6 (patch)
tree8461d308f0956eb799baef34e859f904bf9ea1e3 /src/common/compat.c
parentbc0af7046a2d1025a1d7d5c54698841b1a8bee5b (diff)
downloadtor-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.c15
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