From dev-return-8330-apmail-stdcxx-dev-archive=stdcxx.apache.org@stdcxx.apache.org Mon Nov 03 21:47:07 2008 Return-Path: Delivered-To: apmail-stdcxx-dev-archive@www.apache.org Received: (qmail 78514 invoked from network); 3 Nov 2008 21:47:07 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 3 Nov 2008 21:47:07 -0000 Received: (qmail 64147 invoked by uid 500); 3 Nov 2008 21:47:13 -0000 Delivered-To: apmail-stdcxx-dev-archive@stdcxx.apache.org Received: (qmail 64120 invoked by uid 500); 3 Nov 2008 21:47:13 -0000 Mailing-List: contact dev-help@stdcxx.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@stdcxx.apache.org Delivered-To: mailing list dev@stdcxx.apache.org Received: (qmail 64108 invoked by uid 99); 3 Nov 2008 21:47:13 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 03 Nov 2008 13:47:13 -0800 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: 208.30.140.160 is neither permitted nor denied by domain of msebor@gmail.com) Received: from [208.30.140.160] (HELO moroha.roguewave.com) (208.30.140.160) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 03 Nov 2008 21:45:58 +0000 Received: from nebula.bco.roguewave.com ([10.70.3.8]) by moroha.roguewave.com (8.13.6/8.13.6) with ESMTP id mA3LkG4G003758 for ; Mon, 3 Nov 2008 21:46:26 GMT Message-ID: <490F7129.4010102@gmail.com> Date: Mon, 03 Nov 2008 14:46:17 -0700 From: Martin Sebor Organization: Rogue Wave Software, Inc. User-Agent: Thunderbird 2.0.0.16 (X11/20080723) MIME-Version: 1.0 To: dev@stdcxx.apache.org Subject: Re: svn commit: r710029 - in /stdcxx/branches/4.2.x: src/file.cpp tests/src/file.cpp References: <20081103093359.F35D62388878@eris.apache.org> In-Reply-To: <20081103093359.F35D62388878@eris.apache.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org faridz@apache.org wrote: > Author: faridz > Date: Mon Nov 3 01:33:58 2008 > New Revision: 710029 > > URL: http://svn.apache.org/viewvc?rev=710029&view=rev > Log: > 2008-11-03 Farid Zaripov > > * src/file.cpp (__rw_mkstemp): Fixed calculation of the string length. > [_WIN32]: #define P_tmpdir with a different value on Windows. Added > definition of the tmpdir, initialized by value of TMP instead of TMPDIR. I suspect this was my screwup -- thanks for cleaning it up for me! Martin > * tests/src/file.cpp (rw_tmpnam): Fallback to P_tmpdir if > getenv("TMPDIR") returns empty string. > > Modified: > stdcxx/branches/4.2.x/src/file.cpp > stdcxx/branches/4.2.x/tests/src/file.cpp > > Modified: stdcxx/branches/4.2.x/src/file.cpp > URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/src/file.cpp?rev=710029&r1=710028&r2=710029&view=diff > ============================================================================== > --- stdcxx/branches/4.2.x/src/file.cpp (original) > +++ stdcxx/branches/4.2.x/src/file.cpp Mon Nov 3 01:33:58 2008 > @@ -288,7 +288,7 @@ > char pathbuf [PATH_MAX]; > > // check to see if the buffer is large enough > - const size_t len = strlen (tmpdir) - 1; > + const size_t len = strlen (tmpdir); > if (sizeof pathbuf < len + sizeof rwtmpXXXXXX) { > > # ifdef ENAMETOOLONG > @@ -319,6 +319,15 @@ > > # ifdef _WIN32 > > +# ifndef P_tmpdir // #defined in by POSIX > +# define P_tmpdir "\\" > +# endif // P_tmpdir > + > + // use TMPDIR and fall back on P_tmpdir as per POSIX > + const char *tmpdir = getenv ("TMP"); > + if (0 == tmpdir || '\0' == *tmpdir) > + tmpdir = P_tmpdir; > + > // tempnam(const char *dir, const char *prefix) will generate > // a unique file name for a directory chosen by the following rules: > // > > Modified: stdcxx/branches/4.2.x/tests/src/file.cpp > URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/tests/src/file.cpp?rev=710029&r1=710028&r2=710029&view=diff > ============================================================================== > --- stdcxx/branches/4.2.x/tests/src/file.cpp (original) > +++ stdcxx/branches/4.2.x/tests/src/file.cpp Mon Nov 3 01:33:58 2008 > @@ -213,7 +213,7 @@ > # define TMP_TEMPLATE "tmpfile-XXXXXX" > > const char *tmpdir = getenv ("TMPDIR"); > - if (!tmpdir) > + if (0 == tmpdir || '\0' == *tmpdir) > tmpdir = P_tmpdir; > > if (!buf) { > @@ -259,7 +259,7 @@ > # ifdef _WIN32 > > const char *tmpdir = getenv ("TMP"); > - if (!tmpdir) > + if (0 == tmpdir || '\0' == *tmpdir) > tmpdir = P_tmpdir; > > // create a temporary file name > > >