aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRomain Francoise2005-09-10 19:55:28 +0000
committerRomain Francoise2005-09-10 19:55:28 +0000
commit156bdb41309e1a8311190c3c92d8da4548d1e604 (patch)
treee6cc4e5407df44e1883816b90c80dcf6fd581d2b /src
parent2bb8b80c2099dea53d6de3b232120cfcd4bcb45a (diff)
downloademacs-156bdb41309e1a8311190c3c92d8da4548d1e604.tar.gz
emacs-156bdb41309e1a8311190c3c92d8da4548d1e604.zip
(init_buffer): Grow buffer to add directory separator
and terminal zero.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog5
-rw-r--r--src/buffer.c6
2 files changed, 9 insertions, 2 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 24f0dccea98..f47e48c812d 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
12005-09-10 Romain Francoise <romain@orebokech.com>
2
3 * buffer.c (init_buffer): Grow buffer to add directory separator
4 and terminal zero.
5
12005-09-10 Eli Zaretskii <eliz@gnu.org> 62005-09-10 Eli Zaretskii <eliz@gnu.org>
2 7
3 * buffer.c (init_buffer): Fix error message for failed call to 8 * buffer.c (init_buffer): Fix error message for failed call to
diff --git a/src/buffer.c b/src/buffer.c
index 448ef87413a..e2805a3d1c2 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -5135,7 +5135,7 @@ init_buffer ()
5135 5135
5136 pwd = get_current_dir_name (); 5136 pwd = get_current_dir_name ();
5137 5137
5138 if(!pwd) 5138 if (!pwd)
5139 fatal ("`get_current_dir_name' failed: %s\n", strerror (errno)); 5139 fatal ("`get_current_dir_name' failed: %s\n", strerror (errno));
5140 5140
5141#ifndef VMS 5141#ifndef VMS
@@ -5144,6 +5144,8 @@ init_buffer ()
5144 rc = strlen (pwd); 5144 rc = strlen (pwd);
5145 if (!(IS_DIRECTORY_SEP (pwd[rc - 1]))) 5145 if (!(IS_DIRECTORY_SEP (pwd[rc - 1])))
5146 { 5146 {
5147 /* Grow buffer to add directory separator and '\0'. */
5148 pwd = (char *) xrealloc (pwd, rc + 2);
5147 pwd[rc] = DIRECTORY_SEP; 5149 pwd[rc] = DIRECTORY_SEP;
5148 pwd[rc + 1] = '\0'; 5150 pwd[rc + 1] = '\0';
5149 } 5151 }
@@ -5152,7 +5154,7 @@ init_buffer ()
5152 current_buffer->directory = make_unibyte_string (pwd, strlen (pwd)); 5154 current_buffer->directory = make_unibyte_string (pwd, strlen (pwd));
5153 if (! NILP (buffer_defaults.enable_multibyte_characters)) 5155 if (! NILP (buffer_defaults.enable_multibyte_characters))
5154 /* At this momemnt, we still don't know how to decode the 5156 /* At this momemnt, we still don't know how to decode the
5155 direcotry name. So, we keep the bytes in multibyte form so 5157 directory name. So, we keep the bytes in multibyte form so
5156 that ENCODE_FILE correctly gets the original bytes. */ 5158 that ENCODE_FILE correctly gets the original bytes. */
5157 current_buffer->directory 5159 current_buffer->directory
5158 = string_to_multibyte (current_buffer->directory); 5160 = string_to_multibyte (current_buffer->directory);