aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Eisentraut <peter_e@gmx.net>2011-11-29 22:04:59 +0200
committerPeter Eisentraut <peter_e@gmx.net>2011-11-30 06:55:27 +0200
commit81a50686b884632d2e8b18ecb4c70ea2f39178d6 (patch)
treec8bb1429b82ce717d2b9670a08e4e2cca0142906 /src
parent2767158978796f4ce5cf39d28f29d32b66ee142e (diff)
downloadpostgresql-81a50686b884632d2e8b18ecb4c70ea2f39178d6.tar.gz
postgresql-81a50686b884632d2e8b18ecb4c70ea2f39178d6.zip
Strip file names reported in error messages in vpath builds
In vpath builds, the __FILE__ macro that is used in verbose error reports contains the full absolute file name, which makes the error messages excessively verbose. So keep only the base name, thus matching the behavior of non-vpath builds.
Diffstat (limited to 'src')
-rw-r--r--src/backend/utils/error/elog.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c
index 6e8e5aef4e0..8471d92f57f 100644
--- a/src/backend/utils/error/elog.c
+++ b/src/backend/utils/error/elog.c
@@ -342,7 +342,14 @@ errstart(int elevel, const char *filename, int lineno,
edata->elevel = elevel;
edata->output_to_server = output_to_server;
edata->output_to_client = output_to_client;
- edata->filename = filename;
+ if (filename)
+ {
+ const char *slash;
+
+ /* keep only base name, useful especially for vpath builds */
+ slash = strrchr(filename, '/');
+ edata->filename = slash ? slash + 1 : filename;
+ }
edata->lineno = lineno;
edata->funcname = funcname;
/* the default text domain is the backend's */
@@ -1141,7 +1148,14 @@ elog_start(const char *filename, int lineno, const char *funcname)
}
edata = &errordata[errordata_stack_depth];
- edata->filename = filename;
+ if (filename)
+ {
+ const char *slash;
+
+ /* keep only base name, useful especially for vpath builds */
+ slash = strrchr(filename, '/');
+ edata->filename = slash ? slash + 1 : filename;
+ }
edata->lineno = lineno;
edata->funcname = funcname;
/* errno is saved now so that error parameter eval can't change it */