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) STATIC BOOL flush1(struct buffer FAR * bp)
{ {
/* All lines with changes on 9/4/00 by BER marked below */ BOOL ok = TRUE;
UWORD result; /* BER 9/4/00 */
if ((bp->b_flag & (BFR_VALID | BFR_DIRTY)) == (BFR_VALID | BFR_DIRTY)) if ((bp->b_flag & (BFR_VALID | BFR_DIRTY)) == (BFR_VALID | BFR_DIRTY))
{ {
/* BER 9/4/00 */ #ifdef WITHFAT32
result = dskxfer(bp->b_unit, bp->b_blkno, bp->b_buffer, 1, DSKWRITE); 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) if (bp->b_flag & BFR_FAT)
{ {
UWORD b_copies = bp->b_copies; b_copies = bp->b_copies;
ULONG blkno = bp->b_blkno; b_offset = bp->b_offset;
#ifdef WITHFAT32 #ifdef WITHFAT32
ULONG b_offset = bp->b_offset;
if (b_offset == 0) /* FAT32 FS */ if (b_offset == 0) /* FAT32 FS */
b_offset = bp->b_dpbp->dpb_xfatsize; b_offset = bp->b_dpbp->dpb_xfatsize;
#else
UWORD b_offset = bp->b_offset;
#endif #endif
while (--b_copies > 0) }
while (b_copies--)
{ {
if (dskxfer(bp->b_unit, blkno, bp->b_buffer, 1, DSKWRITE))
ok = FALSE;
blkno += b_offset; blkno += b_offset;
/* BER 9/4/00 */
result = dskxfer(bp->b_unit, blkno, bp->b_buffer, 1, DSKWRITE);
} }
} }
}
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 */ 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. */ bp->b_flag &= ~BFR_VALID; /* continuing. */
return (TRUE); /* Forced to TRUE...was like this before dskxfer() */ return ok;
/* returned error codes...BER */
} }
/* */ /* */

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; bp->b_flag |= BFR_DIR | BFR_DIRTY | BFR_VALID;
} }
/* Clear buffers after directory write or DOS close */ /* Clear buffers after directory write or DOS close */
/* hazard: no error checking! */ return flush_buffers(fnp->f_dpb->dpb_unit);
flush_buffers(fnp->f_dpb->dpb_unit);
return TRUE;
} }
#ifndef IPL #ifndef IPL