delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/06/07/16:41:17

Message-ID: <001101c0ef92$04945eb0$1400a8c0@alex2000>
From: "Alex Oleynikov" <alex AT compuweigh DOT com>
To: <djgpp AT delorie DOT com>
References: <Pine DOT SUN DOT 3 DOT 91 DOT 1010607174442 DOT 1521J-100000 AT is> <002e01c0ef70$d92dffe0$1400a8c0 AT alex2000> <9003-Thu07Jun2001214503+0300-eliz AT is DOT elta DOT co DOT il>
Subject: Re: DJGPP on PTS-DOS run problem
Date: Thu, 7 Jun 2001 16:39:43 -0400
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 5.50.4133.2400
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
Reply-To: djgpp AT delorie DOT com

> However, if findfirst is called, it means that the preceding call to
> _chmod failed, and that is already a sign of trouble.
> ...
> 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?

Call to _chmod( ) fails with the following results:
R.X.AX = 3
R.X.AX_HI = 0x2D
errno = 22

> 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.

Call to findfirst( ) fails with the following results:
R.X.AX = 3
R.X.AX_HI = 0x2D
errno = 22

> 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.

>    _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)

Actually, the findfirst( ) is not called from this place, because
fixed_path[] contains "d:/cd4000/probe.tc/nametest.exe"
( Why? Isn't it should be "d:/cd4000/probe.tc/foo/nametest.exe" ? )

The one that is called is from here (in access( ) ):

...
    /* Devices also fail `_chmod'; some programs won't write to
       a device unless `access' tells them they are writeable.  */
   ret_code = findfirst(fn, &ff, FA_RDONLY | FA_ARCH);  // <== This is where
it fails
   if (ret_code == 0 && (ff.ff_attrib & 0x40) == 0x40
       && (flags & (X_OK | D_OK)) == 0)
    {
      if (strcmp(ff.lfn_magic, "LFN32") == 0)
        _lfn_find_close(ff.lfn_handle);
      return 0;
    }

    errno = ENOENT;
    return -1;
...

> Thanks again for working on this.
It's my pleasure.

Alex

- Raw text -


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