Commit 6e20753d authored by Max Krummenacher's avatar Max Krummenacher Committed by Greg Kroah-Hartman

tty: vt: conmakehash: cope with abs_srctree no longer in env

conmakehash uses getenv("abs_srctree") from the environment to strip
the absolute path from the generated sources.
However since commit e2bad142 ("kbuild: unexport abs_srctree and
abs_objtree") this environment variable no longer gets set.
Instead use basename() to indicate the used file in a comment of the
generated source file.

Fixes: 3bd85c6c ("tty: vt: conmakehash: Don't mention the full path of the input in output")
Cc: stable <stable@kernel.org>
Signed-off-by: default avatarMax Krummenacher <max.krummenacher@toradex.com>
Link: https://lore.kernel.org/stable/20240725132056.9151-1-max.oss.09%40gmail.com
Link: https://lore.kernel.org/r/20240725132056.9151-1-max.oss.09@gmail.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 7d3b793f
......@@ -11,6 +11,8 @@
* Copyright (C) 1995-1997 H. Peter Anvin
*/
#include <libgen.h>
#include <linux/limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <sysexits.h>
......@@ -76,8 +78,8 @@ static void addpair(int fp, int un)
int main(int argc, char *argv[])
{
FILE *ctbl;
const char *tblname, *rel_tblname;
const char *abs_srctree;
const char *tblname;
char base_tblname[PATH_MAX];
char buffer[65536];
int fontlen;
int i, nuni, nent;
......@@ -102,16 +104,6 @@ int main(int argc, char *argv[])
}
}
abs_srctree = getenv("abs_srctree");
if (abs_srctree && !strncmp(abs_srctree, tblname, strlen(abs_srctree)))
{
rel_tblname = tblname + strlen(abs_srctree);
while (*rel_tblname == '/')
++rel_tblname;
}
else
rel_tblname = tblname;
/* For now we assume the default font is always 256 characters. */
fontlen = 256;
......@@ -253,6 +245,8 @@ int main(int argc, char *argv[])
for ( i = 0 ; i < fontlen ; i++ )
nuni += unicount[i];
strncpy(base_tblname, tblname, PATH_MAX);
base_tblname[PATH_MAX - 1] = 0;
printf("\
/*\n\
* Do not edit this file; it was automatically generated by\n\
......@@ -264,7 +258,7 @@ int main(int argc, char *argv[])
#include <linux/types.h>\n\
\n\
u8 dfont_unicount[%d] = \n\
{\n\t", rel_tblname, fontlen);
{\n\t", basename(base_tblname), fontlen);
for ( i = 0 ; i < fontlen ; i++ )
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment