Commit a87ebace authored by Tom Lane's avatar Tom Lane

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.
parent dd136052
...@@ -349,8 +349,10 @@ errstart(int elevel, const char *filename, int lineno, ...@@ -349,8 +349,10 @@ errstart(int elevel, const char *filename, int lineno,
/* keep only base name, useful especially for vpath builds */ /* keep only base name, useful especially for vpath builds */
slash = strrchr(filename, '/'); slash = strrchr(filename, '/');
edata->filename = slash ? slash + 1 : filename; if (slash)
filename = slash + 1;
} }
edata->filename = filename;
edata->lineno = lineno; edata->lineno = lineno;
edata->funcname = funcname; edata->funcname = funcname;
/* the default text domain is the backend's */ /* the default text domain is the backend's */
...@@ -1155,8 +1157,10 @@ elog_start(const char *filename, int lineno, const char *funcname) ...@@ -1155,8 +1157,10 @@ elog_start(const char *filename, int lineno, const char *funcname)
/* keep only base name, useful especially for vpath builds */ /* keep only base name, useful especially for vpath builds */
slash = strrchr(filename, '/'); slash = strrchr(filename, '/');
edata->filename = slash ? slash + 1 : filename; if (slash)
filename = slash + 1;
} }
edata->filename = filename;
edata->lineno = lineno; edata->lineno = lineno;
edata->funcname = funcname; edata->funcname = funcname;
/* errno is saved now so that error parameter eval can't change it */ /* errno is saved now so that error parameter eval can't change it */
......
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