From 6f3475c6c713245f5ec760298af9a04b8465b844 Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 10 Nov 2015 22:33:47 +0000 Subject: If realpath() fails just try the original path. --- cmd-load-buffer.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'cmd-load-buffer.c') diff --git a/cmd-load-buffer.c b/cmd-load-buffer.c index d81288f3..9352cbe5 100644 --- a/cmd-load-buffer.c +++ b/cmd-load-buffer.c @@ -81,8 +81,9 @@ cmd_load_buffer_exec(struct cmd *self, struct cmd_q *cmdq) file = xstrdup(path); else xasprintf(&file, "%s/%s", cwd, path); - if (realpath(file, resolved) == NULL) { - cmdq_error(cmdq, "%s: %s", file, strerror(errno)); + if (realpath(file, resolved) == NULL && + strlcpy(resolved, file, sizeof resolved) >= sizeof resolved) { + cmdq_error(cmdq, "%s: %s", file, strerror(ENAMETOOLONG)); return (CMD_RETURN_ERROR); } f = fopen(resolved, "rb"); -- cgit