From 6cabe044dd07c17bea043d924f414d74086df7b9 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Mon, 21 Sep 2009 10:56:50 +0000 Subject: [PATCH] * fhandler_disk_file.cc (fhandler_disk_file::link): Drop faking hardlink creation on filesystems not supporting hardlinks. --- winsup/cygwin/ChangeLog | 5 +++++ winsup/cygwin/fhandler_disk_file.cc | 14 +++----------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 3a4a81801..bcd823f60 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2009-09-21 Corinna Vinschen + + * fhandler_disk_file.cc (fhandler_disk_file::link): Drop faking hardlink + creation on filesystems not supporting hardlinks. + 2009-09-20 Christopher Faylor * dcrt0.cc (dll_crt0_1): Add another hack to REALLY make sure that diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc index 5e66ae96e..214be47b3 100644 --- a/winsup/cygwin/fhandler_disk_file.cc +++ b/winsup/cygwin/fhandler_disk_file.cc @@ -1249,17 +1249,9 @@ 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 / 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; - } - SetFileAttributesW (newpcw, pc.file_attributes ()); + /* FS doesn't support hard links. Linux returns EPERM. */ + set_errno (EPERM); + return -1; } else { -- 2.43.5