mirror of https://github.com/FDOS/kernel.git
Fixed bug #1722: dir_close() was called for normal files (via map_cluster
and find_fat_free). This completely messed up rwblock. Removed these calls (for directories they are already covered at a higher level) and added a few sanity checks to dir_close and dir_write. git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@761 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
parent
d4f6a7104b
commit
5567aba08b
|
@ -293,6 +293,9 @@ BOOL dir_write(REG f_node_ptr fnp)
|
||||||
struct buffer FAR *bp;
|
struct buffer FAR *bp;
|
||||||
REG UWORD secsize = fnp->f_dpb->dpb_secsize;
|
REG UWORD secsize = fnp->f_dpb->dpb_secsize;
|
||||||
|
|
||||||
|
if (!fnp->f_flags.f_ddir)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
/* Update the entry if it was modified by a write or create... */
|
/* Update the entry if it was modified by a write or create... */
|
||||||
if (fnp->f_flags.f_dmod)
|
if (fnp->f_flags.f_dmod)
|
||||||
{
|
{
|
||||||
|
@ -376,7 +379,7 @@ BOOL dir_write(REG f_node_ptr fnp)
|
||||||
VOID dir_close(REG f_node_ptr fnp)
|
VOID dir_close(REG f_node_ptr fnp)
|
||||||
{
|
{
|
||||||
/* Test for invalid f_nodes */
|
/* Test for invalid f_nodes */
|
||||||
if (fnp == NULL)
|
if (fnp == NULL || !fnp->f_flags.f_ddir)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifndef IPL
|
#ifndef IPL
|
||||||
|
|
|
@ -1025,7 +1025,6 @@ STATIC CLUSTER find_fat_free(f_node_ptr fnp)
|
||||||
{
|
{
|
||||||
dpbp->dpb_xcluster = UNKNCLUSTER;
|
dpbp->dpb_xcluster = UNKNCLUSTER;
|
||||||
write_fsinfo(dpbp);
|
write_fsinfo(dpbp);
|
||||||
dir_close(fnp);
|
|
||||||
return LONG_LAST_CLUSTER;
|
return LONG_LAST_CLUSTER;
|
||||||
}
|
}
|
||||||
if (dpbp->dpb_xnfreeclst != XUNKNCLSTFREE)
|
if (dpbp->dpb_xnfreeclst != XUNKNCLSTFREE)
|
||||||
|
@ -1041,7 +1040,6 @@ STATIC CLUSTER find_fat_free(f_node_ptr fnp)
|
||||||
if (idx > dpbp->dpb_size)
|
if (idx > dpbp->dpb_size)
|
||||||
{
|
{
|
||||||
dpbp->dpb_cluster = UNKNCLUSTER;
|
dpbp->dpb_cluster = UNKNCLUSTER;
|
||||||
dir_close(fnp);
|
|
||||||
return LONG_LAST_CLUSTER;
|
return LONG_LAST_CLUSTER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1395,14 +1393,8 @@ COUNT map_cluster(REG f_node_ptr fnp, COUNT mode)
|
||||||
return DE_SEEK;
|
return DE_SEEK;
|
||||||
/* expand the list if we're going to write and have run into */
|
/* expand the list if we're going to write and have run into */
|
||||||
/* the last cluster marker. */
|
/* the last cluster marker. */
|
||||||
if ((mode == XFR_WRITE) && (last_link(fnp)))
|
if ((mode == XFR_WRITE) && last_link(fnp) && !extend(fnp))
|
||||||
{
|
return DE_HNDLDSKFULL;
|
||||||
if (!extend(fnp))
|
|
||||||
{
|
|
||||||
dir_close(fnp);
|
|
||||||
return DE_HNDLDSKFULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fnp->f_cluster_offset == relcluster)
|
if (fnp->f_cluster_offset == relcluster)
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue