Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

Creating files: Lack of error checking in TF kernel (Developers)

posted by ecm Homepage E-mail, Düsseldorf, Germany, 17.03.2011, 15:40

Oh, so are you creating/truncating a file (by opening it) in this case? Yes, that shouldn't work if the directory is write-protected. (As an aside, DJGPP appears to use the obsolete function 3Ch to open the file if it is to be created - this means that it opens files in compatibility mode, because the caller cannot specify the open/access mode with that function. But that doesn't matter here.)

In The FreeDOS Kernel source I have around (probably 2038 or 2039), functions to create local files call down in this order: (Interrupt 21h handler) -> DosOpen -> DosOpenSft -> dos_open -> dir_write_update (by dir_write macro). In dos_open, a boolean return value of false that can be indicated by dir_write_update would cause an "Access denied" DOS error that would presumably be returned all the way back to the interrupt 21h caller and would release the tables/handles allocated to the file at this point. However, dir_write_update (in fatdir.c) apparently only returns false if it failed to allocate a buffer. This is even indicated by a comment above a call intended to flush buffers for the affected file system, describing that call as "Clear buffers after directory write or DOS close" and pointing out "hazard: no error checking!".

I suspect that writing the changed buffers individually and checking for errors from the device driver at that point would fix your test case. However, there might exist other such cases where The FreeDOS Kernel fails to verify that buffers it intends to flush were written correctly. Function 40h handling ought to be checked.

---
l

 

Complete thread:

Back to the forum
Board view  Mix view
22049 Postings in 2034 Threads, 396 registered users, 282 users online (0 registered, 282 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum