diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2007-08-14 14:48:52 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2007-08-14 14:48:52 +0000 |
commit | 4a971ce403ee1dba9d779219310043816a4c4768 (patch) | |
tree | e74d19e86394d08b204a6f7bb10df91fe169a85f /winsup/cygwin/times.cc | |
parent | 7d2ade334193638dbd55b85e1909408606bcde97 (diff) | |
download | cygnal-4a971ce403ee1dba9d779219310043816a4c4768.tar.gz cygnal-4a971ce403ee1dba9d779219310043816a4c4768.tar.bz2 cygnal-4a971ce403ee1dba9d779219310043816a4c4768.zip |
* fhandler.h (fhandler_base::pc): Make public.
* fhandler_disk_file.cc (fhandler_disk_file::link): Drop extern
declaration of stat_suffixes. Use NT native path in debug output.
(fhandler_base::utimes_fs): Simplify closeit case. Use close_fs
to close newly opened file handle.
(fhandler_base::open_fs): Use NT native path in debug output.
* path.cc: Throughout drop extern declaration of stat_suffixes.
* path.h (stat_suffixes): Declare.
* sec_acl.cc (acl_worker): Drop extern declaration of stat_suffixes.
* times.cc (utimes_worker): Take path_conv as parameter instead of
single-byte pathnam, drop nofollow argument, accommodate throughout.
Compare UNICODE paths when enumerating file descriptors. Fix
formatting. Use NT native path in debug output.
Diffstat (limited to 'winsup/cygwin/times.cc')
-rw-r--r-- | winsup/cygwin/times.cc | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/winsup/cygwin/times.cc b/winsup/cygwin/times.cc index 6dbdc0107..4e1315322 100644 --- a/winsup/cygwin/times.cc +++ b/winsup/cygwin/times.cc @@ -29,6 +29,7 @@ details. */ #include "cygtls.h" #include "sigproc.h" #include "sync.h" +#include "ntdll.h" #define FACTOR (0x19db1ded53e8000LL) #define NSPERSEC 10000000LL @@ -445,10 +446,9 @@ gmtime (const time_t *tim_p) #endif /* POSIX_LOCALTIME */ static int -utimes_worker (const char *path, const struct timeval *tvp, int nofollow) +utimes_worker (path_conv &win32, const struct timeval *tvp) { int res = -1; - path_conv win32 (path, PC_POSIX | (nofollow ? PC_SYM_NOFOLLOW : PC_SYM_FOLLOW)); if (win32.error) set_errno (win32.error); @@ -460,7 +460,9 @@ utimes_worker (const char *path, const struct timeval *tvp, int nofollow) cygheap_fdenum cfd (true); while (cfd.next () >= 0) if (cfd->get_access () & (FILE_WRITE_ATTRIBUTES | GENERIC_WRITE) - && strcmp (cfd->get_win32_name (), win32) == 0) + && RtlEqualUnicodeString (cfd->pc.get_nt_native_path (), + win32.get_nt_native_path (), + TRUE)) { fh = cfd; fromfd = true; @@ -476,7 +478,7 @@ utimes_worker (const char *path, const struct timeval *tvp, int nofollow) { debug_printf ("got %d error from build_fh_name", fh->error ()); set_errno (fh->error ()); - } + } } res = fh->utimes (tvp); @@ -486,7 +488,8 @@ utimes_worker (const char *path, const struct timeval *tvp, int nofollow) } error: - syscall_printf ("%d = utimes (%s, %p)", res, path, tvp); + syscall_printf ("%d = utimes (%S, %p)", + res, win32.get_nt_native_path (), tvp); return res; } @@ -494,14 +497,16 @@ error: extern "C" int utimes (const char *path, const struct timeval *tvp) { - return utimes_worker (path, tvp, 0); + path_conv win32 (path, PC_POSIX | PC_SYM_FOLLOW, stat_suffixes); + return utimes_worker (win32, tvp); } /* BSD */ extern "C" int lutimes (const char *path, const struct timeval *tvp) { - return utimes_worker (path, tvp, 1); + path_conv win32 (path, PC_POSIX | PC_SYM_NOFOLLOW, stat_suffixes); + return utimes_worker (win32, tvp); } /* BSD */ @@ -516,7 +521,7 @@ futimes (int fd, const struct timeval *tvp) else if (cfd->get_access () & (FILE_WRITE_ATTRIBUTES | GENERIC_WRITE)) res = cfd->utimes (tvp); else - res = utimes_worker (cfd->get_win32_name (), tvp, 1); + res = utimes_worker (cfd->pc, tvp); syscall_printf ("%d = futimes (%d, %p)", res, fd, tvp); return res; } |