delorie.com/djgpp/bugs/show.cgi | search |
When invoking other programs with any function from the system() or spawnXX()/execXX() family, the files which stay open in the parent aren't updated on disk. Thus, if the child reads the same file, it could get stale data. While most applications will call fflush() in this situation, this was found not enough in DJGPP. A call to DOS CommitFile function is required to update the filesystem in this case.
In the file src/libc/dos/process/dosexec.c, add a call to sync() at the beginning of direct_exec_tail() function. For compatibility with ANSI/POSIX, sync should be called __sync() and an appropriate alias added to the <libc/stubs.h> header file, and likewise for fsync() which sync() calls.
webmaster | delorie software privacy |
Copyright © 2010 by DJ Delorie | Updated Jul 2010 |