diff options
| author | Romain Francoise | 2005-09-10 19:55:28 +0000 |
|---|---|---|
| committer | Romain Francoise | 2005-09-10 19:55:28 +0000 |
| commit | 156bdb41309e1a8311190c3c92d8da4548d1e604 (patch) | |
| tree | e6cc4e5407df44e1883816b90c80dcf6fd581d2b /src/buffer.c | |
| parent | 2bb8b80c2099dea53d6de3b232120cfcd4bcb45a (diff) | |
| download | emacs-156bdb41309e1a8311190c3c92d8da4548d1e604.tar.gz emacs-156bdb41309e1a8311190c3c92d8da4548d1e604.zip | |
(init_buffer): Grow buffer to add directory separator
and terminal zero.
Diffstat (limited to 'src/buffer.c')
| -rw-r--r-- | src/buffer.c | 6 |
1 files changed, 4 insertions, 2 deletions
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); |