Mercurial > emacs
diff src/buffer.c @ 65438:170f43effa81
(init_buffer): Grow buffer to add directory separator
and terminal zero.
| author | Romain Francoise <romain@orebokech.com> |
|---|---|
| date | Sat, 10 Sep 2005 19:55:28 +0000 |
| parents | c832bf03b2b2 |
| children | 1ffe6d4d0fc4 |
line wrap: on
line diff
--- a/src/buffer.c Sat Sep 10 15:51:28 2005 +0000 +++ b/src/buffer.c Sat Sep 10 19:55:28 2005 +0000 @@ -5135,7 +5135,7 @@ 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 @@ 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 @@ 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);
