diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2008-08-14 19:00:52 +0400 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2008-08-14 19:00:52 +0400 |
commit | 39f50e387b8d70d8f75beec47d7394991c58b4a2 (patch) | |
tree | 1cba7ae5152c4c712050f74f2d10ba25677dc5b9 /winsup/cygwin | |
parent | 88797e5979c906e8bb5b181e4c2511b8b79b5818 (diff) |
* fhandler_disk_file.cc (fhandler_disk_file::link): Fix linking
against symlinks.
Diffstat (limited to 'winsup/cygwin')
-rw-r--r-- | winsup/cygwin/ChangeLog | 5 | ||||
-rw-r--r-- | winsup/cygwin/fhandler_disk_file.cc | 14 |
2 files changed, 10 insertions, 9 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index e6850f679..769bae842 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,5 +1,10 @@ 2008-08-14 Corinna Vinschen <corinna@vinschen.de> + * fhandler_disk_file.cc (fhandler_disk_file::link): Fix linking + against symlinks. + +2008-08-14 Corinna Vinschen <corinna@vinschen.de> + * external.cc (cygwin_internal): Call set_security_attribute with additional path_conv argument. * fhandler.cc (fhandler_base::open): Ditto. diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc index 5fc82302d..5ec3e34f1 100644 --- a/winsup/cygwin/fhandler_disk_file.cc +++ b/winsup/cygwin/fhandler_disk_file.cc @@ -1118,8 +1118,6 @@ fhandler_disk_file::ftruncate (_off64_t length, bool allow_truncate) int fhandler_disk_file::link (const char *newpath) { - extern bool allow_winsymlinks; - path_conv newpc (newpath, PC_SYM_NOFOLLOW | PC_POSIX, stat_suffixes); if (newpc.error) { @@ -1137,7 +1135,7 @@ fhandler_disk_file::link (const char *newpath) char new_buf[strlen (newpath) + 5]; if (!newpc.error) { - if (allow_winsymlinks && pc.is_lnk_special ()) + if (pc.is_lnk_special ()) { /* Shortcut hack. */ stpcpy (stpcpy (new_buf, newpath), ".lnk"); @@ -1182,18 +1180,16 @@ fhandler_disk_file::link (const char *newpath) if (status == STATUS_INVALID_DEVICE_REQUEST) { /* FS doesn't support hard links. Try to copy file. */ - WCHAR pcw[pc.get_nt_native_path ()->Length + 1]; - WCHAR newpcw[newpc.get_nt_native_path ()->Length + 1]; + WCHAR pcw[(pc.get_nt_native_path ()->Length / sizeof (WCHAR)) + 1]; + WCHAR newpcw[(newpc.get_nt_native_path ()->Length / sizeof (WCHAR)) + + 1]; if (!CopyFileW (pc.get_wide_win32_path (pcw), newpc.get_wide_win32_path (newpcw), TRUE)) { __seterrno (); return -1; } - if (!allow_winsymlinks && pc.is_lnk_special ()) - SetFileAttributesW (newpcw, pc.file_attributes () - | FILE_ATTRIBUTE_SYSTEM - | FILE_ATTRIBUTE_READONLY); + SetFileAttributesW (newpcw, pc.file_attributes ()); } else { |