From ca07448759501684b04cce678cee53aa8e2a0c68 Mon Sep 17 00:00:00 2001
From: "Yury V. Zaytsev" <yury@shurup.com>
Date: Thu, 29 Aug 2024 12:13:40 +0200
Subject: [PATCH] vfs: fix tempdir path building to account for trailing slash
on macOS
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
---
lib/vfs/interface.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/lib/vfs/interface.c b/lib/vfs/interface.c
index 63bbddec6..384705120 100644
a
|
b
|
mc_tmpdir (void) |
775 | 775 | static const char *tmpdir = NULL; |
776 | 776 | const char *sys_tmp; |
777 | 777 | struct stat st; |
| 778 | gchar* template; |
778 | 779 | |
779 | 780 | /* Check if already correctly initialized */ |
780 | 781 | if (tmpdir != NULL && lstat (tmpdir, &st) == 0 && S_ISDIR (st.st_mode) && |
… |
… |
mc_tmpdir (void) |
789 | 790 | sys_tmp = TMPDIR_DEFAULT; |
790 | 791 | } |
791 | 792 | |
792 | | g_snprintf (buffer, sizeof (buffer), "%s/mc-XXXXXX", sys_tmp); |
| 793 | template = g_build_filename (sys_tmp, "mc-XXXXXX", (char *) NULL); |
| 794 | g_strlcpy(buffer, template, sizeof (buffer)); |
| 795 | g_free(template); |
| 796 | |
793 | 797 | tmpdir = g_mkdtemp (buffer); |
794 | 798 | if (tmpdir != NULL) |
795 | 799 | g_setenv ("MC_TMPDIR", tmpdir, TRUE); |