Fix a bug where a truncate operation involving truncate() or ftruncate() on
an MSDOSFS file system either failed, silently corrupted the file, or sometimes corrupted the neighboring file. PR: 53695 Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> (original version) MFC: 3 days
This commit is contained in:
parent
b712059588
commit
c2f95f6688
@ -512,26 +512,19 @@ detrunc(dep, length, flags, cred, td)
|
||||
bn = cntobn(pmp, eofentry);
|
||||
error = bread(pmp->pm_devvp, bn, pmp->pm_bpcluster,
|
||||
NOCRED, &bp);
|
||||
} else {
|
||||
bn = de_blk(pmp, length);
|
||||
error = bread(DETOV(dep), bn, pmp->pm_bpcluster,
|
||||
NOCRED, &bp);
|
||||
}
|
||||
if (error) {
|
||||
brelse(bp);
|
||||
if (error) {
|
||||
brelse(bp);
|
||||
#ifdef MSDOSFS_DEBUG
|
||||
printf("detrunc(): bread fails %d\n", error);
|
||||
printf("detrunc(): bread fails %d\n", error);
|
||||
#endif
|
||||
return (error);
|
||||
return (error);
|
||||
}
|
||||
bzero(bp->b_data + boff, pmp->pm_bpcluster - boff);
|
||||
if (flags & IO_SYNC)
|
||||
bwrite(bp);
|
||||
else
|
||||
bdwrite(bp);
|
||||
}
|
||||
/*
|
||||
* is this the right place for it?
|
||||
*/
|
||||
bzero(bp->b_data + boff, pmp->pm_bpcluster - boff);
|
||||
if (flags & IO_SYNC)
|
||||
bwrite(bp);
|
||||
else
|
||||
bdwrite(bp);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user