From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1203 invoked by alias); 27 Jun 2013 18:52:18 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 1138 invoked by uid 89); 27 Jun 2013 18:52:18 -0000 X-Spam-SWARE-Status: No, score=-8.1 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 27 Jun 2013 18:52:17 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r5RIqGC7005343 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 27 Jun 2013 14:52:16 -0400 Received: from brno.lan (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r5RIqF06021504 for ; Thu, 27 Jun 2013 14:52:15 -0400 Subject: [PATCH 2/9] utils.c: pathconf call, check for _PC_PATH_MAX instead of HAVE_UNISTD_H. To: gdb-patches@sourceware.org From: Pedro Alves Date: Thu, 27 Jun 2013 18:52:00 -0000 Message-ID: <20130627185214.6625.1973.stgit@brno.lan> In-Reply-To: <20130627185200.6625.10526.stgit@brno.lan> References: <20130627185200.6625.10526.stgit@brno.lan> User-Agent: StGit/0.16 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-SW-Source: 2013-06/txt/msg00842.txt.bz2 This check in utils.c for HAVE_UNISTD_H is being used as proxy for "HAVE_PATHCONF", as pathconf is supposed to be declared in unistd.h. It's possible that there are systems out there that have realpath, unistd.h and alloca, but not pathconf+_PC_PATH_MAX. I don't know of any by heart, but if we import gnulib's unistd module (which a following patch will do), then unistd.h ends up always available, so the check ends up incorrect. As pathconf is being called with _PC_PATH_MAX, check for that instead. gdb/ 2013-06-27 Pedro Alves * utils.c : Check if _PC_PATH_MAX is defined instead of checking HAVE_UNISTD_H. --- gdb/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gdb/utils.c b/gdb/utils.c index f5c1339..a2015a8 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -3179,7 +3179,7 @@ gdb_realpath (const char *filename) pathconf()) making it impossible to pass a correctly sized buffer to realpath() (it could always overflow). On those systems, we skip this. */ -#if defined (HAVE_REALPATH) && defined (HAVE_UNISTD_H) && defined(HAVE_ALLOCA) +#if defined (HAVE_REALPATH) && defined (_PC_PATH_MAX) && defined(HAVE_ALLOCA) { /* Find out the max path size. */ long path_max = pathconf ("/", _PC_PATH_MAX);