Commit 5273184a authored by Mark Andrews's avatar Mark Andrews
Browse files

Add isc_file_settime() set access and modification times.

parent b04adaa7
......@@ -25,6 +25,9 @@
ISC_LANG_BEGINDECLS
isc_result_t
isc_file_settime(const char *file, isc_time_t *time);
isc_result_t
isc_file_getmodtime(const char *file, isc_time_t *time);
/*
......
......@@ -67,6 +67,21 @@ isc_file_getmodtime(const char *file, isc_time_t *time) {
return (result);
}
isc_result_t
isc_file_settime(const char *file, isc_time_t *time) {
struct timeval times[2];
REQUIRE(file != NULL && time != NULL);
times[0].tv_sec = times[1].tv_sec = isc_time_seconds(time);
times[0].tv_usec = times[1].tv_usec = isc_time_nanoseconds(time)/1000;
if (utimes(file, times) < 0)
return (isc__errno2result(errno));
return (ISC_R_SUCCESS);
}
#undef TEMPLATE
#define TEMPLATE "tmp-XXXXXXXXXX" /* 14 characters. */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment