From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Alfred M\. Szmidt" Newsgroups: gmane.emacs.devel Subject: Re: emacs & MAXPATHLEN Date: Fri, 29 Jul 2005 15:29:24 +0200 Message-ID: <1122643764.870751.6331.nullmailer@Update.UU.SE> References: <87fytzj6a7.fsf@gmail.com> <87pst2h35e.fsf@gmail.com> Reply-To: ams@gnu.org NNTP-Posting-Host: main.gmane.org X-Trace: sea.gmane.org 1122643948 16330 80.91.229.2 (29 Jul 2005 13:32:28 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 29 Jul 2005 13:32:28 +0000 (UTC) Cc: rms@gnu.org, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jul 29 15:32:19 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DyUwm-0002Q4-8f for ged-emacs-devel@m.gmane.org; Fri, 29 Jul 2005 15:30:44 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DyUzH-0005iF-6J for ged-emacs-devel@m.gmane.org; Fri, 29 Jul 2005 09:33:19 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DyUz5-0005ho-8M for emacs-devel@gnu.org; Fri, 29 Jul 2005 09:33:07 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DyUz3-0005gv-Fl for emacs-devel@gnu.org; Fri, 29 Jul 2005 09:33:06 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DyUz3-0005ge-Ah for emacs-devel@gnu.org; Fri, 29 Jul 2005 09:33:05 -0400 Original-Received: from [130.238.4.154] (helo=colibri.its.uu.se) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DyV73-0005Pn-Nw; Fri, 29 Jul 2005 09:41:21 -0400 Original-Received: by colibri.its.uu.se (Postfix, from userid 211) id F1C2B58B; Fri, 29 Jul 2005 15:29:31 +0200 (DFT) Original-Received: from colibri.its.uu.se(127.0.0.1) by colibri.its.uu.se via virus-scan id s14357; Fri, 29 Jul 05 15:29:26 +0200 Original-Received: from Psilocybe.Update.UU.SE (Psilocybe.Update.UU.SE [130.238.19.25]) by colibri.its.uu.se (Postfix) with ESMTP id E96BB57A; Fri, 29 Jul 2005 15:29:25 +0200 (DFT) Original-Received: from localhost (localhost [127.0.0.1]) by Psilocybe.Update.UU.SE (Postfix) with ESMTP id DC25B44003; Fri, 29 Jul 2005 15:29:25 +0200 (CEST) Original-Received: from Psilocybe.Update.UU.SE ([127.0.0.1]) by localhost (Psilocybe [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 17647-03-4; Fri, 29 Jul 2005 15:29:25 +0200 (CEST) Original-Received: from Update.UU.SE (Lem.Update.UU.SE [130.238.19.73]) by Psilocybe.Update.UU.SE (Postfix) with SMTP id 144B044002; Fri, 29 Jul 2005 15:29:25 +0200 (CEST) Original-Received: (nullmailer pid 6332 invoked by uid 30270); Fri, 29 Jul 2005 13:29:24 -0000 Original-To: Giuseppe Scrivano In-reply-to: <87pst2h35e.fsf@gmail.com> (message from Giuseppe Scrivano on Fri, 29 Jul 2005 02:22:37 +0200) 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:41304 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:41304 --- src/buffer.c.old 2005-07-28 19:14:42.000000000 +0200 +++ src/buffer.c 2005-07-29 02:21:03.000000000 +0200 @@ -5146,14 +5146,47 @@ && stat (".", &dotstat) == 0 && dotstat.st_ino == pwdstat.st_ino && dotstat.st_dev == pwdstat.st_dev - && strlen (pwd) < MAXPATHLEN) - strcpy (buf, pwd); -#ifdef HAVE_GETCWD - else if (getcwd (buf, MAXPATHLEN+1) == 0) - fatal ("`getcwd' failed: %s\n", strerror (errno)); +#ifdef MAXPATHLEN + && strlen (pwd) < MAXPATHLEN +#endif + ) + { + buf = malloc(strlen(pwd)+1); + if(!buf) + fatal ("`malloc' failed in init_buffer\n"); + strcpy (buf, pwd); + } +#ifdef _GNU_SOURCE Using _GNU_SOURCE is always wrong, you should check for the feature (in this case, get_current_dir_name ()). That way, any system that implements get_current_dir_name will be free from the MAXPATHLEN limit. Oh, and you should follow the GNU Coding Standard when it comes to indenting.