ReactOS  0.4.14-dev-1112-g2b067d6
utime.c
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: LGPL, See LGPL.txt in the top level directory
3  * PROJECT: ReactOS CRT library
4  * FILE: lib/sdk/crt/time/utime.c
5  * PURPOSE: Implementation of utime, _wutime
6  * PROGRAMERS: Wine team
7  */
8 
9 /*
10  * msvcrt.dll file functions
11  *
12  * Copyright 1996,1998 Marcus Meissner
13  * Copyright 1996 Jukka Iivonen
14  * Copyright 1997,2000 Uwe Bonnes
15  * Copyright 2000 Jon Griffiths
16  * Copyright 2004 Eric Pouech
17  * Copyright 2004 Juan Lang
18  *
19  * This library is free software; you can redistribute it and/or
20  * modify it under the terms of the GNU Lesser General Public
21  * License as published by the Free Software Foundation; either
22  * version 2.1 of the License, or (at your option) any later version.
23  *
24  * This library is distributed in the hope that it will be useful,
25  * but WITHOUT ANY WARRANTY; without even the implied warranty of
26  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
27  * Lesser General Public License for more details.
28  *
29  * You should have received a copy of the GNU Lesser General Public
30  * License along with this library; if not, write to the Free Software
31  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
32  *
33  * TODO
34  * Use the file flag hints O_SEQUENTIAL, O_RANDOM, O_SHORT_LIVED
35  */
36 
37 #include <precomp.h>
38 #include <tchar.h>
39 #define RC_INVOKED 1 // to prevent inline functions
40 #include <sys/utime.h>
41 #include "bitsfixup.h"
42 
43 int
44 _tutime(const _TCHAR* path, struct _utimbuf *t)
45 {
46  int fd = _topen(path, _O_WRONLY | _O_BINARY);
47 
48  if (fd > 0)
49  {
50  int retVal = _futime(fd, t);
51  _close(fd);
52  return retVal;
53  }
54  return -1;
55 }
Definition: utime.h:24
GLdouble GLdouble t
Definition: gl.h:2047
static int fd
Definition: io.c:51
#define _topen
Definition: tchar.h:722
_Check_return_opt_ _CRTIMP int __cdecl _close(_In_ int _FileHandle)
char _TCHAR
Definition: tchar.h:1392
#define _O_BINARY
Definition: cabinet.h:51
int _tutime(const _TCHAR *path, struct _utimbuf *t)
Definition: utime.c:44
#define _O_WRONLY
Definition: cabinet.h:38
_CRTIMP int __cdecl _futime(_In_ int _FileDes, _In_opt_ struct _utimbuf *_Time)