On Sun, 31 Dec 2006 06:28:46 -0800, Paul Pluzhnikov wrote: > Mike - EMAIL IGNORED <[EMAIL PROTECTED]> writes: > >> In the code fragment below, I would have expected a >> failure on the second open, > > Why would you expect that? > >> I would like to generate a failure. How can I do this? > > Use O_EXCL (which exists *just* for that purpose). > >> The file is usually, but not always >> present before the program is run. >
I think not. From man 2 open: O_EXCL When used with O_CREAT, if the file already exists it is an error and the open will fail. In this context, a symbolic link exists, regardless of where its points to. Since in my case, a preexisting file does not mean a failure, this will not serve unless I use a second "locking file". I quick test has verified this. If, in the above, the word "exists" were changed to "opened", my purpose would be served. [...] Mike. _______________________________________________ help-gplusplus mailing list help-gplusplus@gnu.org http://lists.gnu.org/mailman/listinfo/help-gplusplus