From: Paul Eggert <[email protected]> > +#ifdef __VMS > + if (dlen != 0 && dir[dlen - 1] == ':') > + add_slash = false; > +#endif
Oooh, I don't think that I'd do that. If the victim specifies a VMS directory, like, say, "dkc0:[sms]", for TMPDIR, then a ":" test on the last character will fail. As usual, everything's complicated. You could check for ":", "]", or ">", but, strictly speaking, you'd need to make sure that the previous character was not the "^" escape used in exotic ODS5 extended file names. (As with many things on VMS, it gets uglier than one might expect even faster than one might expect.) If the victim _really_ wants to specify a POSIX-like TMPDIR, then he could include his own trailing slash when he does it. I'd rather document that quirk than add the code to do everything right (if that's even possible without dragging $PARSE and/or $SEARCH into the mix). SMS.
