delorie.com/archives/browse.cgi | search |
From: | "Wojciech Galazka" <wojciech DOT galazka AT polkomtel DOT com DOT pl> |
Newsgroups: | comp.os.msdos.djgpp |
Subject: | fstat works incorrectly under Windows NT |
Date: | Thu, 6 Apr 2000 12:52:07 +0200 |
Organization: | http://news.icm.edu.pl/ |
Lines: | 30 |
Message-ID: | <8chqb5$78u$1@sunsite.icm.edu.pl> |
NNTP-Posting-Host: | plus273.polkomtel.com.pl |
Mime-Version: | 1.0 |
X-Trace: | sunsite.icm.edu.pl 955018405 7454 212.2.97.146 (6 Apr 2000 10:53:25 GMT) |
X-Complaints-To: | abuse AT news DOT icm DOT edu DOT pl |
NNTP-Posting-Date: | 6 Apr 2000 10:53:25 GMT |
X-Newsreader: | Microsoft Outlook Express 4.72.3110.5 |
X-MimeOLE: | Produced By Microsoft MimeOLE V4.72.3110.3 |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Reply-To: | djgpp AT delorie DOT com |
Hi, I wonder if anyone had the same problem before and has any ideas how to work over it. Under Windows NT the command 'ln a b' cannot produce a hard link from a file 'a' to a file 'b'. A close inspection of the ln.c soiurce shows that the problem is in libc/posix/unistd/link.c. link() call doesn't work because the call fstat(destination file) (in this case file 'b') returns 0 in the st_dev field of statbuf struct instead of 3 (the file is on drive d:). Consequently the code snippet from link.cpasted below fails /* Fail if path1 and path2 are on different devices */ if (fstat(fd2, &statbuf2) < 0) return -1; if (statbuf1.st_dev != statbuf2.st_dev) { Fstat itself grabs the information for st_dev field from SFT table, which Windows NT does not to fill correctly for a newly created file. All I could think of this for now is to manually 'update' the SFT table while creating the file. Any other ideas?
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |