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;
|
||||
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... */
|
||||
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)
|
||||
{
|
||||
/* Test for invalid f_nodes */
|
||||
if (fnp == NULL)
|
||||
if (fnp == NULL || !fnp->f_flags.f_ddir)
|
||||
return;
|
||||
|
||||
#ifndef IPL
|
||||
|
|
|
@ -1025,7 +1025,6 @@ STATIC CLUSTER find_fat_free(f_node_ptr fnp)
|
|||
{
|
||||
dpbp->dpb_xcluster = UNKNCLUSTER;
|
||||
write_fsinfo(dpbp);
|
||||
dir_close(fnp);
|
||||
return LONG_LAST_CLUSTER;
|
||||
}
|
||||
if (dpbp->dpb_xnfreeclst != XUNKNCLSTFREE)
|
||||
|
@ -1041,7 +1040,6 @@ STATIC CLUSTER find_fat_free(f_node_ptr fnp)
|
|||
if (idx > dpbp->dpb_size)
|
||||
{
|
||||
dpbp->dpb_cluster = UNKNCLUSTER;
|
||||
dir_close(fnp);
|
||||
return LONG_LAST_CLUSTER;
|
||||
}
|
||||
|
||||
|
@ -1395,14 +1393,8 @@ COUNT map_cluster(REG f_node_ptr fnp, COUNT mode)
|
|||
return DE_SEEK;
|
||||
/* expand the list if we're going to write and have run into */
|
||||
/* the last cluster marker. */
|
||||
if ((mode == XFR_WRITE) && (last_link(fnp)))
|
||||
{
|
||||
if (!extend(fnp))
|
||||
{
|
||||
dir_close(fnp);
|
||||
return DE_HNDLDSKFULL;
|
||||
}
|
||||
}
|
||||
if ((mode == XFR_WRITE) && last_link(fnp) && !extend(fnp))
|
||||
return DE_HNDLDSKFULL;
|
||||
|
||||
if (fnp->f_cluster_offset == relcluster)
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue