* cygwin.din (futimes): Export.

(lutimes): Export.
	* times.cc (utimes_worker): Created from utimes, add nofollow flag
	to implement utimes and lutimes.
	(utimes): Just call utimes_worker.
	(lutimes): New function.
	(futimes): Ditto.
	* include/cygwin/version.h: Bump API minor version.
This commit is contained in:
Corinna Vinschen
2005-10-20 14:26:23 +00:00
parent af18e12c9f
commit 81bd1ca723
4 changed files with 47 additions and 5 deletions

View File

@@ -441,12 +441,11 @@ gmtime (const time_t *tim_p)
#endif /* POSIX_LOCALTIME */
/* utimes: POSIX/SUSv3 */
extern "C" int
utimes (const char *path, const struct timeval *tvp)
static int
utimes_worker (const char *path, const struct timeval *tvp, int nofollow)
{
int res = -1;
path_conv win32 (path, PC_SYM_FOLLOW);
path_conv win32 (path, nofollow ? PC_SYM_NOFOLLOW : PC_SYM_FOLLOW);
fhandler_base *fh = NULL;
bool fromfd = false;
@@ -482,6 +481,35 @@ error:
return res;
}
/* utimes: POSIX/SUSv3 */
extern "C" int
utimes (const char *path, const struct timeval *tvp)
{
return utimes_worker (path, tvp, 0);
}
/* BSD */
extern "C" int
lutimes (const char *path, const struct timeval *tvp)
{
return utimes_worker (path, tvp, 1);
}
/* BSD */
extern "C" int
futimes (int fd, const struct timeval *tvp)
{
int res;
cygheap_fdget cfd (fd);
if (cfd < 0)
res = -1;
else
res = cfd->utimes (tvp);
syscall_printf ("%d = futimes (%d, %p)", res, fd, tvp);
return res;
}
/* utime: POSIX 5.6.6.1 */
extern "C" int
utime (const char *path, const struct utimbuf *buf)