r1115 set the dpb_subunit but that was wrong for get_cds() called from AX=4409.

Use a local variable unit to avoid that, and simplify the AX=4409 logic like
in the unstable kernel.


git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1424 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
Bart Oldeman 2009-06-08 18:04:36 +00:00
parent ab6b4ffdf4
commit b8cabddd8e

View File

@ -78,7 +78,7 @@ int DosDevIOctl(lregs * r)
sft FAR *s; sft FAR *s;
struct dpb FAR *dpbp; struct dpb FAR *dpbp;
unsigned attr; unsigned attr;
unsigned char al = r->AL; unsigned char unit, al = r->AL;
if (al > 0x11) if (al > 0x11)
return DE_INVLDFUNC; return DE_INVLDFUNC;
@ -211,45 +211,39 @@ int DosDevIOctl(lregs * r)
#define NDN_HACK #define NDN_HACK
/* NDN feeds the actual ASCII drive letter to this function */ /* NDN feeds the actual ASCII drive letter to this function */
#ifdef NDN_HACK #ifdef NDN_HACK
CharReqHdr.r_unit = ((r->BL & 0x1f) == 0 ? default_drive : unit = ((r->BL & 0x1f) == 0 ? default_drive : (r->BL & 0x1f) - 1);
(r->BL & 0x1f) - 1);
#else #else
CharReqHdr.r_unit = (r->BL == 0 ? default_drive : r->BL - 1); unit = (r->BL == 0 ? default_drive : r->BL - 1);
#endif #endif
dev = NULL; dpbp = get_dpb(unit);
dpbp = get_dpb(CharReqHdr.r_unit);
if (dpbp) if (dpbp)
{ {
dev = dpbp->dpb_device; dev = dpbp->dpb_device;
attr = dev->dh_attr; attr = dev->dh_attr;
CharReqHdr.r_unit = dpbp->dpb_subunit; CharReqHdr.r_unit = dpbp->dpb_subunit;
} }
else if (r->AL != 9) else
return DE_INVLDDRV; {
if (r->AL != 9)
return DE_INVLDDRV;
dev = NULL;
attr = ATTR_REMOTE;
}
switch (r->AL) switch (r->AL)
{ {
case 0x09: case 0x09:
{ {
struct cds FAR *cdsp = get_cds(CharReqHdr.r_unit); /* note from get_dpb() */
r->AX = S_DONE | S_BUSY; /* that if cdsp == NULL then dev must be NULL too */
if (cdsp != NULL && dev == NULL) struct cds FAR *cdsp = get_cds(unit);
{ if (cdsp == NULL)
r->DX = ATTR_REMOTE; return DE_INVLDDRV;
}
else
{
if (dev == NULL)
{
return DE_INVLDDRV;
}
r->DX = attr;
}
if (cdsp->cdsFlags & CDSSUBST) if (cdsp->cdsFlags & CDSSUBST)
{ attr |= ATTR_SUBST;
r->DX |= ATTR_SUBST; r->AX = S_DONE | S_BUSY;
} r->DX = attr;
return SUCCESS; return SUCCESS;
} }
case 0x08: case 0x08: