]> git.eshelyaron.com Git - emacs.git/commitdiff
(init_buffer): Grow buffer to add directory separator
authorRomain Francoise <romain@orebokech.com>
Sat, 10 Sep 2005 19:55:28 +0000 (19:55 +0000)
committerRomain Francoise <romain@orebokech.com>
Sat, 10 Sep 2005 19:55:28 +0000 (19:55 +0000)
and terminal zero.

src/ChangeLog
src/buffer.c

index 24f0dccea98e4c1543d52bec62bfea8a9ee0eb6c..f47e48c812d6c1fd71b99ae2d24433107483a652 100644 (file)
@@ -1,3 +1,8 @@
+2005-09-10  Romain Francoise  <romain@orebokech.com>
+
+       * buffer.c (init_buffer): Grow buffer to add directory separator
+       and terminal zero.
+
 2005-09-10  Eli Zaretskii  <eliz@gnu.org>
 
        * buffer.c (init_buffer): Fix error message for failed call to
index 448ef87413a5ae98ba7a1b14dd3cbef66a7f1591..e2805a3d1c223fd5257fc09b498c352e926b3650 100644 (file)
@@ -5135,7 +5135,7 @@ init_buffer ()
 
   pwd = get_current_dir_name ();
 
-  if(!pwd)
+  if (!pwd)
     fatal ("`get_current_dir_name' failed: %s\n", strerror (errno));
 
 #ifndef VMS
@@ -5144,6 +5144,8 @@ init_buffer ()
   rc = strlen (pwd);
   if (!(IS_DIRECTORY_SEP (pwd[rc - 1])))
     {
+      /* Grow buffer to add directory separator and '\0'.  */
+      pwd = (char *) xrealloc (pwd, rc + 2);
       pwd[rc] = DIRECTORY_SEP;
       pwd[rc + 1] = '\0';
     }
@@ -5152,7 +5154,7 @@ init_buffer ()
   current_buffer->directory = make_unibyte_string (pwd, strlen (pwd));
   if (! NILP (buffer_defaults.enable_multibyte_characters))
     /* At this momemnt, we still don't know how to decode the
-       direcotry name.  So, we keep the bytes in multibyte form so
+       directory name.  So, we keep the bytes in multibyte form so
        that ENCODE_FILE correctly gets the original bytes.  */
     current_buffer->directory
       = string_to_multibyte (current_buffer->directory);