|
fail to write to USB device boot sector
Hi,
I'm writing a C program that reads the boot sector of a USB disk. (it is mounted as /dev/sda1). I'm able to read the sector, by the calls:
fd = open("/dev/sda1", O_RDWR)
and
bytesRead = read(fd, (void*)buf, 512)
And I get the expected value of 512 back from the 'read' call.
The problem is when I wish to write. I use the call:
bytesWrite = write(fd, buf, 512)
The 'write' returns the value of 512, which looks as if the write was successful, yet
when I read again the /dev/sda1 device, I see that no writing was actually made.
Can anybody tell me what do I need to do in order to allow an actual write to the
device?
Thanks in advance,
Moshe
|