[PATCH] mktemp: fix -u option if TMPDIR is set
Tito
farmatito at tiscali.it
Thu Sep 20 13:37:00 UTC 2012
On Thursday 20 September 2012 14:21:45 walter harms wrote:
> I can no reproduce that.
> What libc you are using ?
> What mktemp ? (busybox or others ? if Busybox what version ?)
Hi,
I can reproduce it on Debian 6.0.5 32bit.
but have a cleaner fix.
Ciao,
Tito
>
> re,
> wh
>
> Am 20.09.2012 13:31, schrieb Ron Yorston:
> > With the -u option mktemp uses tempnam to generate the temporary file
> > name. This mostly works as required, but the TMPDIR environment variable
> > trumps any path supplied to tempnam. If TMPDIR is set unexpected behaviour
> > ensues:
> >
> > $ mktemp -u temp.XXXXXX
> > temp.4qYDxk
> > $ mktemp -u -t temp.XXXXXX
> > /tmp/temp.8gP6Pq
> > $ export TMPDIR=/tmp
> > $ mktemp -u temp.XXXXXX
> > mp/temp.BuEBHM
> >
> > Signed-off-by: Ron Yorston <rmy at tigress.co.uk>
> > ---
> > debianutils/mktemp.c | 1 +
> > 1 files changed, 1 insertions(+), 0 deletions(-)
> >
> > diff --git a/debianutils/mktemp.c b/debianutils/mktemp.c
> > index dbe4309..b6833af 100644
> > --- a/debianutils/mktemp.c
> > +++ b/debianutils/mktemp.c
> > @@ -91,6 +91,7 @@ int mktemp_main(int argc UNUSED_PARAM, char **argv)
> > while (--cnt >= 0 && chp[--len] == 'X')
> > chp[len] = '\0';
> >
> > + unsetenv("TMPDIR");
> > chp = tempnam(opts & (OPT_t|OPT_p) ? path : "./", chp);
> > if (!chp)
> > return EXIT_FAILURE;
> _______________________________________________
> busybox mailing list
> busybox at busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox
>
More information about the busybox
mailing list