If the current directory is no longer valid, call dos_cd() for the root to
update the CDS cluster. Call media_check explicitly in truename() as a central first and only place in directory-using DOS calls (except DosFindNext) to call it. git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1473 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
parent
95653072d3
commit
9e1e01e9e6
@ -68,8 +68,7 @@ f_node_ptr dir_open(register const char *dirname, BOOL split, f_node_ptr fnp)
|
|||||||
/* Perform all directory common handling after all special */
|
/* Perform all directory common handling after all special */
|
||||||
/* handling has been performed. */
|
/* handling has been performed. */
|
||||||
|
|
||||||
if (media_check(fnp->f_dpb) < 0)
|
/* truename() already did a media check() */
|
||||||
return (f_node_ptr) 0;
|
|
||||||
|
|
||||||
/* Walk the directory tree to find the starting cluster */
|
/* Walk the directory tree to find the starting cluster */
|
||||||
/* */
|
/* */
|
||||||
|
@ -1482,10 +1482,7 @@ CLUSTER dos_free(struct dpb FAR * dpbp)
|
|||||||
int dos_cd(char * PathName)
|
int dos_cd(char * PathName)
|
||||||
{
|
{
|
||||||
f_node_ptr fnp;
|
f_node_ptr fnp;
|
||||||
struct cds FAR *cdsp = get_cds(PathName[0] - 'A');
|
struct cds FAR *cdsp;
|
||||||
|
|
||||||
if ((media_check(cdsp->cdsDpb) < 0))
|
|
||||||
return DE_INVLDDRV;
|
|
||||||
|
|
||||||
/* now test for its existance. If it doesn't, return an error. */
|
/* now test for its existance. If it doesn't, return an error. */
|
||||||
if ((fnp = dir_open(PathName, FALSE, &fnode[0])) == NULL)
|
if ((fnp = dir_open(PathName, FALSE, &fnode[0])) == NULL)
|
||||||
@ -1493,6 +1490,7 @@ int dos_cd(char * PathName)
|
|||||||
|
|
||||||
/* problem: RBIL table 01643 does not give a FAT32 field for the
|
/* problem: RBIL table 01643 does not give a FAT32 field for the
|
||||||
CDS start cluster. But we are not using this field ourselves */
|
CDS start cluster. But we are not using this field ourselves */
|
||||||
|
cdsp = get_cds(PathName[0] - 'A');
|
||||||
cdsp->cdsStrtClst = (UWORD)fnp->f_dmp->dm_dircluster;
|
cdsp->cdsStrtClst = (UWORD)fnp->f_dmp->dm_dircluster;
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -466,14 +466,16 @@ COUNT truename(const char FAR * src, char * dest, COUNT mode)
|
|||||||
cp[MAX_CDSPATH - 1] = '\0';
|
cp[MAX_CDSPATH - 1] = '\0';
|
||||||
if ((TempCDS.cdsFlags & CDSNETWDRV) == 0)
|
if ((TempCDS.cdsFlags & CDSNETWDRV) == 0)
|
||||||
{
|
{
|
||||||
|
if ((media_check(TempCDS.cdsDpb) < 0))
|
||||||
|
return DE_PATHNOTFND;
|
||||||
|
|
||||||
/* dos_cd ensures that the path exists; if not, we
|
/* dos_cd ensures that the path exists; if not, we
|
||||||
need to change to the root directory */
|
need to change to the root directory */
|
||||||
int result = dos_cd(cp);
|
if (dos_cd(cp) != SUCCESS) {
|
||||||
if (result == DE_PATHNOTFND)
|
|
||||||
cp[TempCDS.cdsBackslashOffset + 1] =
|
cp[TempCDS.cdsBackslashOffset + 1] =
|
||||||
cdsEntry->cdsCurrentPath[TempCDS.cdsBackslashOffset + 1] = '\0';
|
cdsEntry->cdsCurrentPath[TempCDS.cdsBackslashOffset + 1] = '\0';
|
||||||
else if (result < SUCCESS)
|
dos_cd(cp);
|
||||||
return DE_PATHNOTFND;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cp += TempCDS.cdsBackslashOffset;
|
cp += TempCDS.cdsBackslashOffset;
|
||||||
|
Loading…
Reference in New Issue
Block a user