[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: mktemp write failure
From: |
Jim Meyering |
Subject: |
Re: mktemp write failure |
Date: |
Thu, 05 Nov 2009 19:07:20 +0100 |
Eric Blake wrote:
> 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!
It's not just cygwin
Also on fedora 12 and rawhide:
$ ./mktemp -q >&-; echo $?
0
> 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.
- Re: temp file suffixes: mktemp DWIM, (continued)
- 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, 2009/11/05
- 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 <=
Re: temp file suffixes: mktemp DWIM, Eric Blake, 2009/11/09