- Feature Articles
- CodeSOD
- Error'd
-
Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Dateline : 2025/11/26.
There are no comments on this article yet (there will be in a moment), which might be because the actual dateline on the article is 2025/12/02, and yet the Random Article button let me see it anyway...
Admin
did you submit it to last week Error'd?
Edit Admin
Unfortunately, I didn't think of doing that at the time, then I forgot about it in the meantime, until I saw it come up today.
Edit Admin
Ooohhh, that would have been WAY too much fun!
I need to get out more....
Edit Admin
I'm going to go out on a limb and assume ExtractFileName isn't a pure function either, which would make debugging all the more painful.
Edit Admin
It seems a fairly minor WTF but the whole
is itself a WTF since there is a race condition in that, if it exists, something else might have deleted it before you get to do what you want to do with it. You might as well just go ahead and do the operation without testing for existence and handle the errors if they arise.
Edit Admin
ExtractFileName is a pure function. It returns the argument without the drive and directory.
Edit Admin
Yeah, what I tend to call a "toctou" == "Time of Check, Time of Use" (name derived from the reports from the static analyser we use at $JOB).