emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: emacs & MAXPATHLEN


From: Alfred M\. Szmidt
Subject: Re: emacs & MAXPATHLEN
Date: Fri, 29 Jul 2005 15:29:24 +0200

   --- 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.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]