summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2011-11-30 00:37:27 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2011-11-30 00:37:27 -0500
commit646a93fe761eb2e1887fc8b3c9d778a6028b248d (patch)
treeff12eba6d0ef54614b63891c6f4195096cfe3db7
parentfe0fa1f9b403a84f25b163a02e8676119e37b097 (diff)
Tweak previous patch to ensure edata->filename always gets initialized.
On a platform that isn't supplying __FILE__, previous coding would either crash or give a stale result for the filename string. Not sure how likely that is, but the original code catered for it, so let's keep doing so.
-rw-r--r--src/backend/utils/error/elog.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c
index 428b4f9b6fd..6b3ba2a31ca 100644
--- a/src/backend/utils/error/elog.c
+++ b/src/backend/utils/error/elog.c
@@ -337,8 +337,10 @@ errstart(int elevel, const char *filename, int lineno,
/* keep only base name, useful especially for vpath builds */
slash = strrchr(filename, '/');
- edata->filename = slash ? slash + 1 : filename;
+ if (slash)
+ filename = slash + 1;
}
+ edata->filename = filename;
edata->lineno = lineno;
edata->funcname = funcname;
/* the default text domain is the backend's */
@@ -1112,8 +1114,10 @@ elog_start(const char *filename, int lineno, const char *funcname)
/* keep only base name, useful especially for vpath builds */
slash = strrchr(filename, '/');
- edata->filename = slash ? slash + 1 : filename;
+ if (slash)
+ filename = slash + 1;
}
+ edata->filename = filename;
edata->lineno = lineno;
edata->funcname = funcname;
/* errno is saved now so that error parameter eval can't change it */