Ethereal-dev: Re: [Ethereal-dev] file_exists() returning the oposite?

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Ulf Lamping <ulf.lamping@xxxxxx>
Date: Wed, 08 Feb 2006 02:19:13 +0100

Is there some reason why we don't simply check whether eth_stat() returns
-1 or not?  On UN*X, to test whether a file exists, you would probably try
to stat it and, if the stat fails with ENOENT, say it doesn't exist,
otherwise (i.e., if it succeeds *or* if it fails and sets errno to
something other than ENOENT) say it does (even if we don't have permission
to look for it).

Would that work on Windows as well?
I can't remember the exact cause of the hack I've implemented here, but I remember that there *was* a real reason that the obvious solution didn't worked on WIN32.

I don't want to redebug the whole problem again, as I know the current solution works on WIN32 (and the obvious solution don't work for some reason) ...

The "This is a bit tricky on win32" comment says it all :-(

Regards, ULFL


P.S: The comment is really improvable and I'll have to learn how to write comments that are understandable even after a few months (hmmm, usually I'm not that bad on that topic) :-(