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:
Bart Oldeman 2009-07-05 21:21:14 +00:00
parent 95653072d3
commit 9e1e01e9e6
3 changed files with 9 additions and 10 deletions

View File

@ -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 */
/* handling has been performed. */
if (media_check(fnp->f_dpb) < 0)
return (f_node_ptr) 0;
/* truename() already did a media check() */
/* Walk the directory tree to find the starting cluster */
/* */

View File

@ -1482,10 +1482,7 @@ CLUSTER dos_free(struct dpb FAR * dpbp)
int dos_cd(char * PathName)
{
f_node_ptr fnp;
struct cds FAR *cdsp = get_cds(PathName[0] - 'A');
if ((media_check(cdsp->cdsDpb) < 0))
return DE_INVLDDRV;
struct cds FAR *cdsp;
/* now test for its existance. If it doesn't, return an error. */
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
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;
return SUCCESS;
}

View File

@ -466,14 +466,16 @@ COUNT truename(const char FAR * src, char * dest, COUNT mode)
cp[MAX_CDSPATH - 1] = '\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
need to change to the root directory */
int result = dos_cd(cp);
if (result == DE_PATHNOTFND)
if (dos_cd(cp) != SUCCESS) {
cp[TempCDS.cdsBackslashOffset + 1] =
cdsEntry->cdsCurrentPath[TempCDS.cdsBackslashOffset + 1] = '\0';
else if (result < SUCCESS)
return DE_PATHNOTFND;
dos_cd(cp);
}
}
cp += TempCDS.cdsBackslashOffset;