[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
mktemp write failure (was: temp file suffixes: mktemp DWIM)
From: |
Eric Blake |
Subject: |
mktemp write failure (was: temp file suffixes: mktemp DWIM) |
Date: |
Thu, 5 Nov 2009 16:57:37 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
Eric Blake <ebb9 <at> byu.net> writes:
> > Fortunately, 'mktemp >&-' does not make the mistake of printing the just-
> > created file as the contents of that file, since we close the fd returned
by
> > mkstemp before printing anything.
>
> How about the following?
Phooey.
mktemp >&-
detects write error, but
mktemp -q >&-
does not! We are calling freopen(,stderr), and at least on cygwin, that ends
up changing(!) stderr's underlying fd from 2 to 1, so that the file name is
successfully printed to /dev/null. This is probably a bug in cygwin's stdio
implementation of freopen, so I need to check whether other libc's are affected
similarly. But is certainly seems like I will need to implement freopen_safer
in gnulib to guarantee that when reopening one of the std streams, that the new
fd is identical to the original. I'm working on a fix.
--
Eric Blake
- Re: [PATCHv2 0/7] Re: temp file suffixes: mktemp DWIM, (continued)
- Re: temp file suffixes: mktemp DWIM, Eric Blake, 2009/11/03
- Re: temp file suffixes: mktemp DWIM, Jim Meyering, 2009/11/03
- Re: temp file suffixes: mktemp DWIM, Pádraig Brady, 2009/11/03
- Re: temp file suffixes: mktemp DWIM, Eric Blake, 2009/11/04
- Re: temp file suffixes: mktemp DWIM, Eric Blake, 2009/11/04
- Re: temp file suffixes: mktemp DWIM, Jim Meyering, 2009/11/04
- mktemp write failure (was: temp file suffixes: mktemp DWIM),
Eric Blake <=
- Re: mktemp write failure, Eric Blake, 2009/11/05
- Re: mktemp write failure, Eric Blake, 2009/11/05
- Re: mktemp write failure, Jim Meyering, 2009/11/06
- Re: mktemp write failure, Eric Blake, 2009/11/06
- Re: mktemp write failure, Jim Meyering, 2009/11/06
- Re: mktemp write failure, Eric Blake, 2009/11/06
- Re: mktemp write failure, Jim Meyering, 2009/11/05
Re: temp file suffixes: mktemp DWIM, Eric Blake, 2009/11/09