21 June 2003

+ Fix error where we could allocate a used sector!  ARGH!
This commit is contained in:
Vince Weaver 2003-06-21 22:26:00 -04:00
parent 04ac80431e
commit 25b5b8a946
2 changed files with 6 additions and 2 deletions

2
Changelog Normal file
View File

@ -0,0 +1,2 @@
21 June 2003
+ Fix error where we could allocate a used sector! ARGH!

View File

@ -250,6 +250,8 @@ int find_first_one(unsigned char byte) {
int i=0; int i=0;
if (byte==0) return -1;
while((byte& (0x1<<i))==0) { while((byte& (0x1<<i))==0) {
i++; i++;
} }
@ -313,7 +315,7 @@ int dos33_allocate_sector(int fd) {
do { do {
for(byte=0;byte<2;byte++) { for(byte=1;byte>-1;byte--) {
bitmap[byte]=buffer[VTOC_FREE_BITMAPS+(i*4)+byte]; bitmap[byte]=buffer[VTOC_FREE_BITMAPS+(i*4)+byte];
if (bitmap[byte]!=0x00) { if (bitmap[byte]!=0x00) {
@ -321,7 +323,7 @@ int dos33_allocate_sector(int fd) {
found_track=i; found_track=i;
/* clear bit indicating in use */ /* clear bit indicating in use */
buffer[VTOC_FREE_BITMAPS+(i*4)+byte]&=~(0x1<<found_sector); buffer[VTOC_FREE_BITMAPS+(i*4)+byte]&=~(0x1<<found_sector);
found_sector+=(8*byte); found_sector+=(8*(1-byte));
goto found_one; goto found_one;
} }
} }