This is the mail archive of the cygwin-patches@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

link(2) fails on mounted network shares


Hello,

I recently found out that you cannot create hardlinks
on mounted network shares with cygwin
(error: No such file or directory),
but you can do it with the ln.exe from Interix.

So I looked at it and found that the Windows API
function CreateHardLink() causes the trouble, it apparently
only works for local drives.

There is another API function, however, which creates hardlinks
correctly on local and network drives (tested on Win2003 shares
and Samba shares):

MoveFileEx() with parameter:
#define MOVEFILE_CREATE_HARDLINK 16

I have attached a very simple ln program to demonstrate it.
It can be compiled with the MS compiler from
http://msdn.microsoft.com/visualc/vctoolkit2003/

You might consider changing fhandler_disk_file.cc to use
MoveFileEx() instead of CreateHardLink().

Martin

Attachment: ln.c
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]