www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/04/02/02:05:42

Date: Fri, 2 Apr 1999 09:03:40 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Frank Frederiksen <ff AT kom DOT auc DOT dk>
cc: djgpp AT delorie DOT com
Subject: Re: Strange errors with _get_dev_info
In-Reply-To: <E10NzQb-0004tJ-00@hercules.kom.auc.dk>
Message-ID: <Pine.SUN.3.91.990402085916.22974K-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Fri, 19 Mar 1999, Frank Frederiksen wrote:

> >   /* Scan from c: and upwards */
> >   for(drive=2;drive<setdisk(getdisk());drive++) {
> >     if(_get_dev_info(drive)==-1)
> >       printf("Error on drive %c (%d)\n", drive+'A', errno);
> >     else
> >       printf("Drive %c is OK\n", drive+'A');
> >   }

Sorry for a late reply.

I'm afraid this is simply a bug in the DJGPP docs: the libc reference 
says that the argument to _get_dev_info is a handle or a drive number.  
The latter part is incorrect: the function accepts *only* file handles.  
So, to get info about a disk file, you need to open a file on that disk, 
and then pass the handle to _get_dev_info.

The strange behavior you reported is due to the fact that the function 
was interpreting the argument as a file handle, and thus any open handle, 
like those in the 0-4 range, would succeed, while the rest would fail.

I'm sorry for the confusion; I just checked in a change for the next 
release.

- Raw text -


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