Michael Devore wrote:

At 04:01 PM 7/21/2005 -0500, I wrote:

When you invoke FDISK without arguments, it goes into the Interactive_User_Interface() routine. That, in turn, asks about FAT32 support, via Ask_User_About_FAT32_Support() function. OK so far. After that call -- without any further prompting -- FDISK calls the Create_MBR_If_Not_Present() routine.

NO. Please, no. You should never write to the hard disk for low-level stuff like partitions and master boot record data without warning and giving the user a chance to abort or decide not to do it.


Second related issue...the Create_MBR_If_Not_Present() routine receives an error code if Read_Physical_Sectors() routine fails, but the error code is not checked. Consequently, should the routine to read physical sectors fail for any reason and return an error, the following occurs: The buffer which was not loaded by the read is still tested for valid values and if they fail to match what was expected (as they likely will) a new MBR is written.

That is probably the wrong approach to handling an error on the low-level disk read. Particularly at startup.


I have a work in progress towards fixing these issues of fdisk,
to try my current build -  http://www.fdos.org/kernel/test/fdisk.exe

Currently I have it so it delays actual writing of MBR to disk until just before program exit (so if you reboot or in advanced mode abort your changes, the mbr=CHS(0,0,1) should be unmodified). It also now aborts on read error with a message. Note: fdisk may still write to other sectors than mbr during use, eg boot sector of partition. This build also has a pause and message that shows the disks the MBR is being written to. I'll continue working on this a little while longer, but this build is here for feedback.

Jeremy





-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Freedos-user mailing list
Freedos-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-user

Reply via email to