summaryrefslogtreecommitdiff
path: root/usr.bin/tmux
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2024-10-12 08:20:33 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2024-10-12 08:20:33 +0000
commitea2f39075e260e9cbe039fa692c951ea8cbbf940 (patch)
tree2c0e402fbae47ef0c16e70a89c9d00b1e4f5df54 /usr.bin/tmux
parent9b190a7dde0170cacb642fc0e301880457cae98d (diff)
Call realpath on the source file to match -f on the command line, GitHub
issue 4180.
Diffstat (limited to 'usr.bin/tmux')
-rw-r--r--usr.bin/tmux/cmd-source-file.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/usr.bin/tmux/cmd-source-file.c b/usr.bin/tmux/cmd-source-file.c
index 83c29bf6544..01e4a8a8ae8 100644
--- a/usr.bin/tmux/cmd-source-file.c
+++ b/usr.bin/tmux/cmd-source-file.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-source-file.c,v 1.54 2023/09/15 06:31:49 nicm Exp $ */
+/* $OpenBSD: cmd-source-file.c,v 1.55 2024/10/12 08:20:32 nicm Exp $ */
/*
* Copyright (c) 2008 Tiago Cunha <me@tiagocunha.org>
@@ -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);