diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2021-04-02 10:43:54 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2021-04-02 10:43:54 -0400 |
commit | 53aafdb9ff6a561c7dea0f428a7c168f2b7e0f16 (patch) | |
tree | 052cb6b2aeb14caa8a2424017d1fc8fbd31f180f | |
parent | 1877c9ac3acc05cc787dd6392d073202f8c8ee21 (diff) | |
download | postgresql-53aafdb9ff6a561c7dea0f428a7c168f2b7e0f16.tar.gz postgresql-53aafdb9ff6a561c7dea0f428a7c168f2b7e0f16.zip |
Strip file names reported in error messages on Windows, too.
Commit dd136052b established a policy that error message FILE items
should include only the base name of the reporting source file, for
uniformity and succinctness. We now observe that some Windows compilers
use backslashes in __FILE__ strings, so truncate at backslashes as well.
This is expected to fix some platform variation in the results of the
new libpq_pipeline test module.
Discussion: https://postgr.es/m/3650140.1617372290@sss.pgh.pa.us
-rw-r--r-- | src/backend/utils/error/elog.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index 423df2f3006..12de4b38cba 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -529,6 +529,10 @@ errfinish(const char *filename, int lineno, const char *funcname) slash = strrchr(filename, '/'); if (slash) filename = slash + 1; + /* Some Windows compilers use backslashes in __FILE__ strings */ + slash = strrchr(filename, '\\'); + if (slash) + filename = slash + 1; } edata->filename = filename; |