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 <alpha@qzx.com>

Bug existed since version 2.4.2, commit ec8d51be.
master
Benno Schulenberg 2019-09-16 16:57:46 +02:00
parent 7b88557ef5
commit dbcf4f0cbe
1 changed files with 1 additions and 1 deletions

View File

@ -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);