From patchwork Mon Jul 12 16:04:33 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pascal Obry X-Patchwork-Id: 58632 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id EFBD6B6EEF for ; Tue, 13 Jul 2010 02:04:41 +1000 (EST) Received: (qmail 27239 invoked by alias); 12 Jul 2010 16:04:36 -0000 Received: (qmail 26827 invoked by uid 22791); 12 Jul 2010 16:04:34 -0000 X-SWARE-Spam-Status: No, hits=0.7 required=5.0 tests=AWL, BAYES_20, RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from smtp28.orange.fr (HELO smtp28.orange.fr) (80.12.242.99) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 12 Jul 2010 16:04:29 +0000 Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf2803.orange.fr (SMTP Server) with ESMTP id A70427003D73; Mon, 12 Jul 2010 18:04:26 +0200 (CEST) Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf2803.orange.fr (SMTP Server) with ESMTP id 994977003E29; Mon, 12 Jul 2010 18:04:26 +0200 (CEST) Received: from [192.168.0.100] (AVelizy-154-1-6-85.w82-124.abo.wanadoo.fr [82.124.68.85]) by mwinf2803.orange.fr (SMTP Server) with ESMTP id 64D817003D73; Mon, 12 Jul 2010 18:04:26 +0200 (CEST) X-ME-User-Auth: pascal.obry Message-ID: <4C3B3D11.7030501@adacore.com> Date: Mon, 12 Jul 2010 18:04:33 +0200 From: Pascal Obry Reply-To: obry@adacore.com User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; fr-FR; rv:1.8.1.22) Gecko/20090605 Thunderbird/2.0.0.22 Mnenhy/0.7.5.0 MIME-Version: 1.0 To: gcc-patches Subject: [PATCH] - fix handling of temporary directories on Windows Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org ChangeLog: 2010-07-09 Pascal Obry * libibery/make-temp-file.c (choose_tmpdir): When TMPDIR, TMP and TEMP are not set, P_tmpdir is used on Windows. This is defined as "\" in current MingW header. Append a dot to ensure that when concatenating with \dir we do not end-up with an UNC path. Fix a crash on the compiler. Patch as attachment. diff libiberty/make-temp-file.c libiberty/make-temp-file.c index 13e1925..f754b45 100644 --- libiberty/make-temp-file.c +++ libiberty/make-temp-file.c @@ -121,7 +121,12 @@ choose_tmpdir (void) #endif #ifdef P_tmpdir - base = try_dir (P_tmpdir, base); + /* We really want a directory name here as if concatenated with say \dir + we do not end-up with a double \\ which defines an UNC path. */ + if (strcmp (P_tmpdir, "\\") == 0) + base = try_dir ("\\.", base); + else + base = try_dir (P_tmpdir, base); #endif /* Try /var/tmp, /usr/tmp, then /tmp. */