From dbcf4f0cbef7134685c571a5e4b49830a2432068 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Mon, 16 Sep 2019 16:57:46 +0200 Subject: [PATCH] color: don't concatenate an absolute path with the working directory When the user specified an absolute path... it is NOT relative to the current working directory. This fixes https://savannah.gnu.org/bugs/?56902. Reported-by: Brand Huntsman Bug existed since version 2.4.2, commit ec8d51be. --- src/color.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/color.c b/src/color.c index ac401e59..fef26d89 100644 --- a/src/color.c +++ b/src/color.c @@ -197,7 +197,7 @@ void color_update(void) char *joinednames = charalloc(PATH_MAX + 1); char *fullname = NULL; - if (currentdir != NULL) { + if (currentdir != NULL && openfile->filename[0] != '/') { /* Concatenate the current working directory with the * specified filename, and canonicalize the result. */ sprintf(joinednames, "%s/%s", currentdir, openfile->filename);