delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/09/06/13:49:26

From: eric AT osiris DOT com DOT au (Eric Mills)
Subject: link() is copying on NTFS
6 Sep 1997 13:49:26 -0700 :
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <9709050330.AA29442.cygnus.gnu-win32@osiris.com.au>
X-Authentication-Warning: sydney.dialix.com.au: osiruucp set sender to sydney!eric using -f
Original-To: gnu-win32 AT cygnus DOT com
Original-Sender: owner-gnu-win32 AT cygnus DOT com

On NT4.0sp3 on NTFS filesystem running b18

I MUST be missing some fundamental configuration option but...

It appears as if the link() system call is actually copying the file!
While one has to do that on FAT - NTFS does support multiple names for a
file. This trivial program:

#include <sys/types.h>
#include <sys/stat.h>
main(ac, av)
int	ac;
char	**av;
{
    struct stat	sb;

    if (link(av[1], av[2]) == 0
    && stat(av[2], &sb) == 0) {
	printf("Links = %d\n", sb.st_nlink);
	return 0;
    }
    return 1;
}

prints 1 on gnu-win32 and 2 on UNIX (provided the target does not exist! etc
etc) The new file on gnu-win32 is really different....
The "ln" command is consequently broken as well.

Thanks, Eric Mills.
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019