blob: 52eeb34e2dc7274795a390f8aa208c35aec5af05 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#include "lib.h"
#include <sys/types.h>
#include <time.h>
#include <utime.h>
#include <errno.h>
#include <stdlib.h>
#include "sys9.h"
#include "dir.h"
int
utime(const char *path, const struct utimbuf *times)
{
int n;
Dir nd;
time_t curt;
_nulldir(&nd);
if(times == 0) {
curt = time(0);
nd.atime = curt;
nd.mtime = curt;
} else {
nd.atime = times->actime;
nd.mtime = times->modtime;
}
n = _dirwstat(path, &nd);
if(n < 0)
_syserrno();
return n;
}
|