From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Jan D." Newsgroups: gmane.emacs.devel Subject: Re: emacs & MAXPATHLEN Date: Sat, 30 Jul 2005 13:27:23 +0200 Message-ID: <6A777234-348C-42E3-9FE1-7519B533F134@swipnet.se> References: <87fytzj6a7.fsf@gmail.com> <87pst2h35e.fsf@gmail.com> <87r7dhxenv.fsf@gmail.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 (Apple Message framework v733) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1122723698 23360 80.91.229.2 (30 Jul 2005 11:41:38 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 30 Jul 2005 11:41:38 +0000 (UTC) Cc: Giuseppe Scrivano , rms@gnu.org, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jul 30 13:41:35 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DypiU-0008E7-4l for ged-emacs-devel@m.gmane.org; Sat, 30 Jul 2005 13:41:22 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Dypl1-0004nW-Qs for ged-emacs-devel@m.gmane.org; Sat, 30 Jul 2005 07:43:59 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DypiB-0004NA-Ae for emacs-devel@gnu.org; Sat, 30 Jul 2005 07:41:03 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Dypi2-0004I3-6x for emacs-devel@gnu.org; Sat, 30 Jul 2005 07:40:59 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Dypi0-0003r1-9V for emacs-devel@gnu.org; Sat, 30 Jul 2005 07:40:52 -0400 Original-Received: from [195.54.107.73] (helo=mxfep02.bredband.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DyphR-0001k1-M1; Sat, 30 Jul 2005 07:40:18 -0400 Original-Received: from coolsville.localdomain ([83.226.180.210] [83.226.180.210]) by mxfep02.bredband.com with ESMTP id <20050730112813.HITV6295.mxfep02.bredband.com@coolsville.localdomain>; Sat, 30 Jul 2005 13:28:13 +0200 In-Reply-To: Original-To: Eli Zaretskii X-Mailer: Apple Mail (2.733) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:41335 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:41335 > >> +#else >> + { >> + int buf_size = 2; >> + buf = xmalloc (buf_size); >> + for(;;) >> + { >> + if(getcwd (buf, buf_size) == 0) >> + { >> + if(errno == ERANGE) >> + { >> + buf_size *= 2; >> + buf = xrealloc (buf, buf_size); >> + } >> + else >> + fatal ("`getcwd' failed: %s\n", strerror (errno)); >> + } >> + else >> + break; >> + } >> + >> + } >> +#endif >> You can initialize buf_size to something bigger than 2. This almost guarantees multiple calls to realloc. Try 1024 or something more reasonable that will at least hold most paths. 2 will only hold "/" and nothing else. Also, space after if and for. Jan D.