No longer force flush1() and dir_write_update() to return TRUE if there

were disk write errors. Part 1 for fixing
http://www.bttr-software.de/forum/forum_entry.php?id=9783
Bug: File creation does not check whether buffers are written correctly


git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1561 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
Bart Oldeman 2011-04-08 15:35:23 +00:00
parent 6bf9271256
commit 77d0f502c0
2 changed files with 19 additions and 25 deletions

View File

@ -305,41 +305,37 @@ BOOL flush_buffers(REG COUNT dsk)
/* */
STATIC BOOL flush1(struct buffer FAR * bp)
{
/* All lines with changes on 9/4/00 by BER marked below */
UWORD result; /* BER 9/4/00 */
BOOL ok = TRUE;
if ((bp->b_flag & (BFR_VALID | BFR_DIRTY)) == (BFR_VALID | BFR_DIRTY))
{
/* BER 9/4/00 */
result = dskxfer(bp->b_unit, bp->b_blkno, bp->b_buffer, 1, DSKWRITE);
#ifdef WITHFAT32
ULONG b_offset = 0;
#else
UWORD b_offset = 0;
#endif
UBYTE b_copies = 1;
ULONG blkno = bp->b_blkno;
if (bp->b_flag & BFR_FAT)
{
UWORD b_copies = bp->b_copies;
ULONG blkno = bp->b_blkno;
b_copies = bp->b_copies;
b_offset = bp->b_offset;
#ifdef WITHFAT32
ULONG b_offset = bp->b_offset;
if (b_offset == 0) /* FAT32 FS */
b_offset = bp->b_dpbp->dpb_xfatsize;
#else
UWORD b_offset = bp->b_offset;
#endif
while (--b_copies > 0)
{
blkno += b_offset;
/* BER 9/4/00 */
result = dskxfer(bp->b_unit, blkno, bp->b_buffer, 1, DSKWRITE);
}
}
while (b_copies--)
{
if (dskxfer(bp->b_unit, blkno, bp->b_buffer, 1, DSKWRITE))
ok = FALSE;
blkno += b_offset;
}
}
else
result = 0; /* This negates any error code returned in result...BER */
/* and 0 returned, if no errors occurred - tom */
bp->b_flag &= ~BFR_DIRTY; /* even if error, mark not dirty */
if (result != 0) /* otherwise system has trouble */
if (!ok) /* otherwise system has trouble */
bp->b_flag &= ~BFR_VALID; /* continuing. */
return (TRUE); /* Forced to TRUE...was like this before dskxfer() */
/* returned error codes...BER */
return ok;
}
/* */

View File

@ -278,9 +278,7 @@ BOOL dir_write_update(REG f_node_ptr fnp, BOOL update)
bp->b_flag |= BFR_DIR | BFR_DIRTY | BFR_VALID;
}
/* Clear buffers after directory write or DOS close */
/* hazard: no error checking! */
flush_buffers(fnp->f_dpb->dpb_unit);
return TRUE;
return flush_buffers(fnp->f_dpb->dpb_unit);
}
#ifndef IPL