From f8b56fdc3f1f45d0fc731f1e1a252c4fe318099b Mon Sep 17 00:00:00 2001 From: nicm Date: Sat, 12 Oct 2024 08:20:32 +0000 Subject: [PATCH] Call realpath on the source file to match -f on the command line, GitHub issue 4180. --- cmd-source-file.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cmd-source-file.c b/cmd-source-file.c index 38d56d31..67f353b9 100644 --- a/cmd-source-file.c +++ b/cmd-source-file.c @@ -122,6 +122,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); -- 2.11.4.GIT