Mail Archives: djgpp-workers/2005/05/14/18:09:42
> 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 -