link(2) fails on mounted network shares
Martin Koeppe
mkoeppe@gmx.de
Mon May 30 23:39:00 GMT 2005
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ln.c
Type: application/octet-stream
Size: 1060 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20050530/1892e990/attachment.obj>
More information about the Cygwin-patches
mailing list