bug-make
[Top][All Lists]
Advanced

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

Re: [PATCH] Fix some temp file issues


From: Paul Eggert
Subject: Re: [PATCH] Fix some temp file issues
Date: Fri, 7 Oct 2022 21:37:24 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.1

On 10/7/22 05:36, Eli Zaretskii wrote:

I'd appreciate a more high-level description of the idea of the
change, in addition to the gory details.

I gave it a shot in the attached patch, which is an improved version of the previous patch.


Why !WINDOWS32 here?

Earlier versions of the code avoided the use of tmpfile on MS-Windows since it might put the temp file in the root directory even if the user has specified a different directory in MAKE_TMPDIR or some similar environment variable.

Come to think of it, that problem is not limited to MS-Windows; there's a similar problem on POSIX too. So the attached patch removes the "!WINDOWS32" here, and attacks the problem in the similar way on all platforms, by using tmpfile only if the environment variables are unset or specify the default directory anyway.


This opens the file in binary mode where previously it wasn't; what is
the rationale for the change?  And why the "+" part?

tmpfile uses "wb+" (POSIX requires this) and we should be consistent in all the paths that create temporary FILE *. The attached patch adds a comment about this.

Thanks for the review.

Attachment: 0001-Fix-some-temp-file-issues.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]