Use absolute PSL path to make psl_builtin_outdated() work reliable
This commit is contained in:
parent
583f97f2bf
commit
b53273d406
|
@ -237,6 +237,7 @@ int main(int argc, const char **argv)
|
||||||
struct stat st;
|
struct stat st;
|
||||||
size_t cmdsize = 16 + strlen(argv[1]);
|
size_t cmdsize = 16 + strlen(argv[1]);
|
||||||
char *cmd = alloca(cmdsize), checksum[64] = "";
|
char *cmd = alloca(cmdsize), checksum[64] = "";
|
||||||
|
char *abs_srcfile;
|
||||||
const char *source_date_epoch = NULL;
|
const char *source_date_epoch = NULL;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -256,6 +257,7 @@ int main(int argc, const char **argv)
|
||||||
if (stat(argv[1], &st) != 0)
|
if (stat(argv[1], &st) != 0)
|
||||||
st.st_mtime = 0;
|
st.st_mtime = 0;
|
||||||
fprintf(fpout, "static time_t _psl_file_time = %lu;\n", st.st_mtime);
|
fprintf(fpout, "static time_t _psl_file_time = %lu;\n", st.st_mtime);
|
||||||
|
|
||||||
if ((source_date_epoch = getenv("SOURCE_DATE_EPOCH")))
|
if ((source_date_epoch = getenv("SOURCE_DATE_EPOCH")))
|
||||||
fprintf(fpout, "static time_t _psl_compile_time = %lu;\n", atol(source_date_epoch));
|
fprintf(fpout, "static time_t _psl_compile_time = %lu;\n", atol(source_date_epoch));
|
||||||
else
|
else
|
||||||
|
@ -264,6 +266,13 @@ int main(int argc, const char **argv)
|
||||||
fprintf(fpout, "static int _psl_nexceptions = %d;\n", psl->nexceptions);
|
fprintf(fpout, "static int _psl_nexceptions = %d;\n", psl->nexceptions);
|
||||||
fprintf(fpout, "static int _psl_nwildcards = %d;\n", psl->nwildcards);
|
fprintf(fpout, "static int _psl_nwildcards = %d;\n", psl->nwildcards);
|
||||||
fprintf(fpout, "static const char _psl_sha1_checksum[] = \"%s\";\n", checksum);
|
fprintf(fpout, "static const char _psl_sha1_checksum[] = \"%s\";\n", checksum);
|
||||||
|
|
||||||
|
/* We need an absolute path here, else psl_builtin_outdated() won't work reliable */
|
||||||
|
/* Caveat: symbolic links are resolved by realpath() */
|
||||||
|
if ((abs_srcfile = realpath(argv[1], NULL))) {
|
||||||
|
fprintf(fpout, "static const char _psl_filename[] = \"%s\";\n", abs_srcfile);
|
||||||
|
free(abs_srcfile);
|
||||||
|
} else
|
||||||
fprintf(fpout, "static const char _psl_filename[] = \"%s\";\n", argv[1]);
|
fprintf(fpout, "static const char _psl_filename[] = \"%s\";\n", argv[1]);
|
||||||
|
|
||||||
if (fclose(fpout) != 0)
|
if (fclose(fpout) != 0)
|
||||||
|
|
Loading…
Reference in New Issue