NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: bin/47757: mktemp(3) mangles the pathname if not given an absolute path

On Sun, Apr 21, 2013 at 07:45:05PM +0000, Martin Husemann wrote:
> The following reply was made to PR bin/47757; it has been noted by GNATS.
> From: Martin Husemann <>
>  Did the relative ./tmp path exist?

Hi Martin,

No the path doesn't exist, but on other platforms that I've tried (MacOS,
Linux, OpenBSD, FreeBSD) *template is modified correctly weather the
path exists or not.

>  The function incorrectly does not return NULL on this type of failure.
>  Note that you should use mkstemp(3) anyway.

Perhaps I should explain my use case a little more. I'm using this
function as part of a unit test that generates pathnames for functions
that would normally expect user input (argv[1]). Part of the syntax for
the user supplies is an optional prefix, '+'


The utility strips off the '+' later on, but I need to generate random
paths that include this pattern. I could invent a workaround that adds
the prefix after running mktemp(3)/mkstemp(3), but the man page doesn't
indicate that the paths must start with '/'.


Home | Main Index | Thread Index | Old Index