Reverted latest changes.
[reactos.git] / reactos / lib / msvcrt / io / utime.c
1 #include <msvcrt/stdio.h>
2 #include <msvcrt/io.h>
3 #include <msvcrt/errno.h>
4 #include <msvcrt/sys/utime.h>
5 #include <msvcrt/internal/file.h>
6
7 int _utime(const char* filename, struct _utimbuf* buf)
8 {
9 int fn;
10 int ret;
11
12 fn = _open(filename, _O_RDWR);
13 if (fn == -1)
14 {
15 __set_errno(EBADF);
16 return -1;
17 }
18 ret = _futime(fn,buf);
19 if (_close(fn) < 0)
20 return -1;
21 return ret;
22 }
23
24 int _wutime(const wchar_t* filename, struct _utimbuf* buf)
25 {
26 int fn;
27 int ret;
28
29 fn = _wopen(filename, _O_RDWR);
30 if (fn == -1)
31 {
32 __set_errno(EBADF);
33 return -1;
34 }
35 ret = _futime(fn,buf);
36 if (_close(fn) < 0)
37 return -1;
38 return ret;
39 }