From: "Wojciech Galazka" Newsgroups: comp.os.msdos.djgpp Subject: Re: fstat works incorrectly under Windows NT Date: Fri, 7 Apr 2000 11:25:09 +0200 Organization: http://news.icm.edu.pl/ Lines: 50 Message-ID: <8ck9k5$ob6$1@sunsite.icm.edu.pl> References: <8chqb5$78u$1 AT sunsite DOT icm DOT edu DOT pl> <38ECE535 DOT D0414969 AT is DOT elta DOT co DOT il> NNTP-Posting-Host: plus273.polkomtel.com.pl Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-2 Content-Transfer-Encoding: 8bit X-Trace: sunsite.icm.edu.pl 955099589 24934 212.2.97.146 (7 Apr 2000 09:26:29 GMT) X-Complaints-To: abuse AT news DOT icm DOT edu DOT pl NNTP-Posting-Date: 7 Apr 2000 09:26:29 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 Eli Zaretskii wrote in a message: <38ECE535 DOT D0414969 AT is DOT elta DOT co DOT il>... >Question no.1: did you compile `ln' yourself, or are you using the binary >from fil316b.zip on SimTel? >Question no.2: with what version of DJGPP did you test this? At first I used a binary version then used that one compiled myself with DJGPP 2.01 Sounds that I need to upgrade, though >> 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) > >Question no.3: if `fstat' returns 0 for st_dev, and if it does that for both >files, then the above snippet should succeed, right? So what exactly is the >problem? For an already existing file the return for st_dev is 3 (dirve d:) but for a newly created file the result is 0 so the code fails. The new file was created within ln.c code using Win32 call, and not int 21h, AH=6C call hovewer > >> Fstat itself grabs the information for st_dev field from SFT table > >No. On NT, `fstat' is supposed to get st_dev from the IOCTL call issued by >the function _get_dev_info; the SFT is not used on NT because NT doesn't >emulate it. Please step with a debugger into `fstat' and see whether that >this is what happens, or perhaps there's some bug. > >Are you sure NT indeed creates the SFT in its DOS box? AFAIK, it doesn't. >That's why `fstat' doesn't use it: `fstat' has built-in sanity checks for the >data in the SFT, which AFAIK fail on NT. Well, I stopped debugginf the codes on link() function. I'll bring the debugger once more to see how fstast() really works. I'm not sure if fstat uses SFT, and it's the first thing I'll check. Thanks for you suggestions