From dev-return-8321-apmail-stdcxx-dev-archive=stdcxx.apache.org@stdcxx.apache.org Mon Oct 20 22:11:59 2008 Return-Path: Delivered-To: apmail-stdcxx-dev-archive@www.apache.org Received: (qmail 46594 invoked from network); 20 Oct 2008 22:11:59 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 20 Oct 2008 22:11:59 -0000 Received: (qmail 94724 invoked by uid 500); 20 Oct 2008 22:12:02 -0000 Delivered-To: apmail-stdcxx-dev-archive@stdcxx.apache.org Received: (qmail 94697 invoked by uid 500); 20 Oct 2008 22:12:02 -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 94686 invoked by uid 99); 20 Oct 2008 22:12:01 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Oct 2008 15:12:01 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [208.30.140.160] (HELO moroha.roguewave.com) (208.30.140.160) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Oct 2008 22:10:53 +0000 Received: from exchmail01.Blue.Roguewave.Com (exchmail01.blue.roguewave.com [10.22.129.22]) by moroha.roguewave.com (8.13.6/8.13.6) with ESMTP id m9KMBUup000993 for ; Mon, 20 Oct 2008 22:11:30 GMT X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: [PATCH] STDCXX-401 test suite should honor TMPDIR Date: Mon, 20 Oct 2008 16:10:50 -0600 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PATCH] STDCXX-401 test suite should honor TMPDIR Thread-Index: AckzAKlad7DTUt65RjCx4Ws3HhOVug== From: "Scott Zhong" To: X-Virus-Checked: Checked by ClamAV on apache.org Changelog: * tests/src/file.cpp (rw_tmpnam): use TMPDIR variable from environment if defined. here is the patch: Index: tests/src/file.cpp =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- tests/src/file.cpp (revision 702657) +++ tests/src/file.cpp (working copy) @@ -208,8 +208,13 @@ #ifndef _RWSTD_NO_MKSTEMP # define TMP_TEMPLATE "tmpfile-XXXXXX" =20 + const char *tmpdir =3D getenv ("TMPDIR"); + if (tmpdir =3D=3D NULL) {=20 + tmpdir =3D P_tmpdir; + } + if (!buf) { - static char fname_buf [sizeof (P_tmpdir) + sizeof (TMP_TEMPLATE)]; + static char fname_buf [PATH_MAX]; =20 buf =3D fname_buf; *buf =3D '\0'; @@ -217,13 +222,13 @@ =20 if ('\0' =3D=3D *buf) { // copy the template to the buffer; make sure there is exactly - // one path separator character between P_tmpdir and the file + // one path separator character between tmpdir and the file // name template (it doesn't really matter how many there are // as long as it's at least one, but one looks better than two // in diagnostic messages) - size_t len =3D sizeof (P_tmpdir) - 1; + size_t len =3D strlen (tmpdir) - 1; =20 - memcpy (buf, P_tmpdir, len); + memcpy (buf, tmpdir, len); if (_RWSTD_PATH_SEP !=3D buf [len - 1]) buf [len++] =3D _RWSTD_PATH_SEP; =20 @@ -251,7 +256,7 @@ # ifdef _WIN32 =20 // create a temporary file name - char* fname =3D tempnam (P_tmpdir, ".rwtest-tmp"); + char* fname =3D tempnam (tmpdir, ".rwtest-tmp"); =20 if (fname) { =20 @@ -272,7 +277,7 @@ else { fprintf (stderr, "%s:%d: tempnam(\"%s\", \"%s\") failed: %s\n", __FILE__, __LINE__, - P_tmpdir, ".rwtest-tmp", strerror (errno)); + tmpdir, ".rwtest-tmp", strerror (errno)); } =20 # else