This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [libgfortran, patch] More than 26 temporary files with weak mktemp()


On Wed, Mar 16, 2011 at 23:50, FX <fxcoudert@gmail.com> wrote:
>> If M$ mktemp when already 26 files exist with the same prefix at least
>> properly fails, then it would be better to just retry with a changed prefix
>> if it fails.
>
>
> Done exactly that. Manually tested on i586-pc-mingw32, regtested on x86_64-linux by editing config.h to fake the absence of mkstemp(). OK for trunk?

Some minor nits:

- Use the type size_t for tempdirlen as that is the return type of
strlen() and argument type for get_mem().

- You can use a const size_t variable for the length of the string
"slash" rather than calling strlen() in the do-while loop.

- Don't set errno as we anyway loop until we successfully open a file
with O_CREAT|O_EXCL.

With these changes, Ok for trunk (4.7, that is).

-- 
Janne Blomqvist


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]