svn commit: r240843 - head/usr.sbin/bsdconfig/timezone/share

Garrett Cooper yanegomi at gmail.com
Mon Sep 24 17:00:37 UTC 2012


On Mon, Sep 24, 2012 at 9:45 AM, Devin Teske <devin.teske at fisglobal.com> wrote:
>
> On Sep 23, 2012, at 8:13 PM, Doug Barton wrote:
>
>> On 09/22/2012 15:16, Devin Teske wrote:
>>> -            if : 2> /dev/null > "$_PATH_DB"; then
>>> +            if true 2> /dev/null > "$_PATH_DB"; then
>>>                      cat <<-EOF > "$_PATH_DB"
>>>                      $zoneinfo
>>>                      EOF
>>
>> Is there a reason you're not using mktemp here?
>>
>
> Hi Doug,
>
> There is indeed a reason that mktemp is not used in this situation.
>
> 1. No possibility of a race condition, so little-to-no need for mktemp.
> 2. Using mktemp in a "file-truncate operation" would just be "wrong" (quoting others).
>
> P.S. I posited your question to IRC to see what general consensus was and many agreed that mktemp is not right in this situation.

    Indeed. It's either going to pass (truncate the file) or fail. No
sense in using a temporary file here.
Thanks,
-Garrett


More information about the svn-src-all mailing list