@orgin
Quote:
I just tried on a hard drive partition with SFS and it didn't respect the write flag at all (SFS).
Of course not. Unlike for example Unix AmigaOS has separate write and delete permissions. [F]Open("ExistingFile", MODE_NEWFILE) is a delete (+ create new file) operation, not a write (something to an existing file).
Quote:
The file was overwritten without any error (including comment, date and protect flags)
Unless you copy them from the old file the new file has the default protection bits (for example ---- ---- ----rw-d), comment (none), date/time (current time), etc.
To get what you expect, modifying an existing file instead of replacing it with a new one, you have to use something like
file = IDOS->FOpen("foobar", MODE_READWRITE, buffersize);
IDOS->ChangeMode(file, CHANGE_FH, EXCLUSIVE_LOCK);
IDOS->ChangeFileSize(file, 0, OFFSET_BEGINNING);
instead, which works on delete protected but not on write protected files and keeps the protection bits, comments, user/group, etc., instead of using file = IDOS->FOpen("foobar", MODE_NEWFILE, buffersize) which replaces the file with a completely new one (unless the old one was delete protected).
Edited by joerg on 2009/3/19 17:45:01
Edited by joerg on 2009/3/19 17:45:57