aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/os/fs.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/os/fs.c b/src/os/fs.c
index a76a6358ff..ee7424d745 100644
--- a/src/os/fs.c
+++ b/src/os/fs.c
@@ -33,10 +33,12 @@ int mch_chdir(char *path) {
*/
int mch_dirname(char_u *buf, int len)
{
+ assert(buf && len);
+
int errno;
- if ((errno = uv_cwd((char *) buf, len)) != 0) {
- STRCPY(buf, uv_strerror(errno));
- return FAIL;
+ if ((errno = uv_cwd((char *)buf, len)) != 0) {
+ vim_strncpy(buf, (char_u *)uv_strerror(errno), len - 1);
+ return FAIL;
}
return OK;
}