delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/06/07/14:51:46

Date: Thu, 07 Jun 2001 21:45:03 +0300
From: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>
Sender: halo1 AT zahav DOT net DOT il
To: "Alex Oleynikov" <alex AT compuweigh DOT com>
Message-Id: <9003-Thu07Jun2001214503+0300-eliz@is.elta.co.il>
X-Mailer: Emacs 20.6 (via feedmail 8.3.emacs20_6 I) and Blat ver 1.8.9
CC: djgpp AT delorie DOT com
In-reply-to: <002e01c0ef70$d92dffe0$1400a8c0@alex2000>
Subject: Re: DJGPP on PTS-DOS run problem
References: <Pine DOT SUN DOT 3 DOT 91 DOT 1010607174442 DOT 1521J-100000 AT is> <002e01c0ef70$d92dffe0$1400a8c0 AT alex2000>
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> From: "Alex Oleynikov" <alex AT compuweigh DOT com>
> Date: Thu, 7 Jun 2001 12:42:32 -0400
> 
> > Eventually you will come to a low-level function which calls __dpmi_int,
> > to use some DOS service, and fails.  You don't need to go any further:
> > just post here where did that happen, and what error code did that DOS
> > function return in the __dpmi_regs structure accepted by __dpmi_int.
> 
> Inside access( ) there is a call to findfirst( ), which fails with errno=22
> (ENOENT)

Thanks for looking into this.

However, if findfirst is called, it means that the preceding call to
_chmod failed, and that is already a sign of trouble.

Here's the beginning of `access':

int access(const char *fn, int flags)
{
  int attr = _chmod(fn, 0);

  if (attr == -1) {
    struct ffblk ff;
    char fixed_path[FILENAME_MAX];

    /* Root directories on some non-local drives (e.g. CD-ROM)
       might fail `_chmod'.  `findfirst' to the rescue.  */
    _fixpath(fn, fixed_path);
    if (fixed_path[1] == ':' && fixed_path[2] == '/' && fixed_path[3] == 0)
      {
        char *fp = fixed_path + 3;

        *fp++ = '*';
        *fp++ = '.';
        *fp++ = '*';
        *fp++ = '\0';
        /* Use _lfn_close_handle so we don't lose a handle.  */
        if (findfirst(fixed_path, &ff, FA_DIREC) == 0)

As you see, findfirst is called only if _chmod returns -1, meaning
that it failed.  Could you please look inside _chmod and see what
happens there, and what is the DOS error code returned in the AX
register by __dpmi_int called from _chmod?

As for findfirst, in addition to the carry flag being set, __dpmi_int
also returns an error code in regs.x.ax.  Please see what is the value
of this.

Finally, it might be important to know what does _fixpath return in
the fixed_path[] string, because that's the file name we pass to
findfirst.

Thanks again for working on this.

- Raw text -


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