delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2011/07/02/08:09:51

X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f
X-Recipient: djgpp-workers AT delorie DOT com
X-Authenticated: #27081556
X-Provags-ID: V01U2FsdGVkX19txHJwH2dt5ALI29rX75CS3Jr7xhxonqMbiKrJvP
TzFuDe0OP5iHfW
From: Juan Manuel Guerrero <juan DOT guerrero AT gmx DOT de>
To: djgpp-workers AT delorie DOT com
Subject: Re: [patch] make _dos_getfileattr to return r.x.cx
Date: Sat, 2 Jul 2011 14:03:15 +0200
User-Agent: KMail/1.9.10
References: <BANLkTikONeSs9a4yssD3CRBXbGe2Meygng AT mail DOT gmail DOT com>
In-Reply-To: <BANLkTikONeSs9a4yssD3CRBXbGe2Meygng@mail.gmail.com>
MIME-Version: 1.0
Message-Id: <201107021403.16193.juan.guerrero@gmx.de>
X-Y-GMX-Trusted: 0
Reply-To: djgpp-workers AT delorie DOT com

Am Samstag, 2. Juli 2011 schrieb Ozkan Sezer:
> On Wed, Jun 8, 2011 at 3:37 AM, DJ Delorie <dj AT delorie DOT com> wrote:
> >
> > ------- Start of forwarded message -------
> > Date: Tue, 7 Jun 2011 20:13:01 -0400 (EDT)
> > From: David Winfrey <dlw AT patriot DOT net>
> > To: dj AT delorie DOT com
> > Subject: Possible bug in _dos_getfileattr
> > Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
> >
> >
> > I believe that _dos_getfileattr(),
> > in src\libc\dos\compat\d_getfa.c in the gcc452b.zip file,
> > needs to return r.x.cx instead of r.x.ax.
> >
> > It's consistently returning 0x4300, regardless of the
> > actual file attributes; this is the r.x.ax input value
> > for the DOS get_attributes call.
> >
> > Thanks,
> >
> > David L. Winfrey
> > dlw AT patriot DOT net
> > www.patriot.net/users/dlw
> > www.wsumc.net
> > ------- End of forwarded message -------
> >
> 
> The patch below is after the above bug report from the
> thread above.  The lfn-aware version _chmod() returns r.x.cx
> too, so the suggestion seems valid, hence the suggested
> patch.
> 
> Regards.
> 
> Index: d_getfa.c
> ===================================================================
> RCS file: /cvs/djgpp/djgpp/src/libc/dos/compat/d_getfa.c,v
> retrieving revision 1.1
> diff -U 7 -p -r1.1 d_getfa.c
> --- d_getfa.c	25 Nov 1995 02:18:00 -0000	1.1
> +++ d_getfa.c	2 Jul 2011 08:33:24 -0000
> @@ -31,10 +31,10 @@ unsigned int _dos_getfileattr(const char
>    r.x.ds = __tb / 16;
>    __dpmi_int(0x21, &r);
>    if ( r.x.flags & 1 )
>    {
>      errno = __doserr_to_errno(r.x.ax);
>      return r.x.ax;
>    }
> -  *p_attr = r.x.ax;
> +  *p_attr = r.x.cx;
>    return 0;
>  }
> 
> 
> --
> O.S.
> 


According to RBIL, if Int21/AX=4300h returns successfully the file attribute
will be in CX and certainly not in AX.  If no one objects I will commit the
patch below.

Regards,
Juan M. Guerrero


	* src/libc/dos/compat/d_getfa.c: Return file attribute.
	From Ozkan Sezer. <sezeroz AT gmail DOT com>
	Reported by David L. Winfrey < dlw AT patriot DOT net>

Index: djgpp/src/libc/dos/compat/d_getfa.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/libc/dos/compat/d_getfa.c,v
retrieving revision 1.1
diff -U 5 -r1.1 d_getfa.c
--- djgpp/src/libc/dos/compat/d_getfa.c	25 Nov 1995 02:18:00 -0000	1.1
+++ djgpp/src/libc/dos/compat/d_getfa.c	2 Jul 2011 11:54:08 -0000
@@ -33,8 +33,8 @@
   if ( r.x.flags & 1 )
   {
     errno = __doserr_to_errno(r.x.ax);
     return r.x.ax;
   }
-  *p_attr = r.x.ax;
+  *p_attr = r.x.cx;
   return 0;
 }

- Raw text -


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