Add a touch_file() function to compat so we can update cache mtimes.

svn:r5067
This commit is contained in:
Nick Mathewson
2005-09-14 23:27:52 +00:00
parent bc0af7046a
commit 6973ef9be4
3 changed files with 17 additions and 1 deletions
+15
View File
@@ -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
+1
View File
@@ -127,6 +127,7 @@ struct tm *tor_gmtime_r(const time_t *timep, struct tm *result);
/* ===== File compatibility */
int replace_file(const char *from, const char *to);
int touch_file(const char *fname);
#ifdef MS_WINDOWS
#define PATH_SEPARATOR "\\"