delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2005/05/14/18:09:42

X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f
From: sandmann AT clio DOT rice DOT edu (Charles Sandmann)
Message-Id: <10505142208.AA27063@clio.rice.edu>
Subject: Re: DJGPP v2.04 Bugs - suggested patch
To: djgpp-workers AT delorie DOT com
Date: Sat, 14 May 2005 17:08:54 -0500 (CDT)
In-Reply-To: <200505130833.j4D8XUIH029244@speedy.ludd.ltu.se> from "ams@ludd.ltu.se" at May 13, 2005 10:33:29 AM
X-Mailer: ELM [version 2.5 PL2]
Mime-Version: 1.0
X-Virus-Scanned: by amavis-20030616-p6 at mail.rice.edu
X-DCC--Metrics: handler11.mail.rice.edu 1067; Body=1 Fuz1=1 Fuz2=1
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> According to Charles Sandmann:
> > A quick analysis of _open does not show a good way to fail and 
> > retry without a complete restructuring of the code, or maybe additional
> > flag variables.
> 
> I've de-spaghetti-fied it and if you tell me exactly under which
> conditions it should retry, I'll add that and post a patch.
> 
> Most optimal would be the if statement, something like:
> /* Carry from INT 0x21,AX=0x716c set. */
> if( r.x.ax == X && some other condition )

I got a chance today to code for the first time in a long time.  Attached
is a fix that seems to work.

*** _open.c     Mon Oct 21 00:28:28 2002
--- _open2.c    Sat May 14 17:05:06 2005
***************
*** 1,2 ****
--- 1,3 ----
+ /* Copyright (C) 2005 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 2002 DJ Delorie, see COPYING.DJ for details */
  /* Copyright (C) 2001 DJ Delorie, see COPYING.DJ for details */
***************
*** 22,25 ****
--- 23,27 ----
    int rv;
    int use_lfn = _USE_LFN;
+   char retry = 0;

    if (filename == 0)
***************
*** 94,98 ****
--- 96,103 ----
        r.x.dx = 1;                        /* Open existing file */
        r.x.si = __tb_offset;
+       retry = 1;
      } else {
+ do_retry:
+       retry = 0;
        r.h.ah = 0x3d;
        r.h.al = oflag;
***************
*** 107,110 ****
--- 112,117 ----
    if(r.x.flags & 1)
    {
+     if(retry && r.x.ax == 80)
+       goto do_retry;
      errno = __doserr_to_errno(r.x.ax);
      return -1;

- Raw text -


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