On Fri, 19 Dec 1997 22:00:21 +0100, Frank Heckenbach wrote:
Kevin A. Foss wrote:
The problem (as noted in the comments) is that if the bind fails it thinks the file exists, which is a bit of a kludge. However I couldn't get around the problem that appeared when a user gives a name that is used by a directory. Frank's code using stat() correctly reports true for directories.
Well... but I think in most cases it would be more appropriate to return false for directories (I hadn't thought about this problem at all) because I'd usually call this functions before trying to open the file for reading or updating.
Yeah, that's true -- I was thinking of using a check for file existance to check and see if the filename was available for creating a file with a unique filename. But your use is more common and good code would check to see if the bind fails anyway.
So, I think it would be better to return false if the binding fails.
Yes I do too, now that I considered the actual usage of the function. :)
-Kevin -- Kevin A. Foss --- kfoss@mint.net --