diff --git a/cmd-source-file.c b/cmd-source-file.c index b390ed63..86c4b138 100644 --- a/cmd-source-file.c +++ b/cmd-source-file.c @@ -121,6 +121,14 @@ cmd_source_file_done(struct client *c, const char *path, int error, static void cmd_source_file_add(struct cmd_source_file_data *cdata, const char *path) { + char resolved[PATH_MAX]; + + if (realpath(path, resolved) == NULL) { + log_debug("%s: realpath(\"%s\") failed: %s", __func__, + path, strerror(errno)); + } else + path = resolved; + log_debug("%s: %s", __func__, path); cdata->files = xreallocarray(cdata->files, cdata->nfiles + 1, sizeof *cdata->files); diff --git a/paste.c b/paste.c index 608ac9c6..11991217 100644 --- a/paste.c +++ b/paste.c @@ -240,6 +240,8 @@ paste_rename(const char *oldname, const char *newname, char **cause) } pb_new = paste_get_name(newname); + if (pb_new == pb) + return (0); if (pb_new != NULL) paste_free(pb_new);