It has been seen on 3.12 and beta verson of Green River that an NLM using multiple threads attempting to open the same file with fopen(), some threads will end up with the same file handle. This causes a problem when one thread closes the file, then another thread that had the same file handle attempts to access the file after the file handle has been freed.
This problem is resolved by using sopen() to open the file, then using fdopen() to get a stream-io file handle.
sopen opens the file for shared access and returns an (int) handle for OS file operations such as read() and write(). If you desire to do stream-io operations to a (FILE *) pointer such as fputs() and fgets() etc, then use fdopen() to associate that OS file handle with a stream-io file handle.
| ifss001.exe | 19.0 K | 2005-04-06 |
© 2009 Novell, Inc. All Rights Reserved.