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


_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

Reply via email to