From: Tom Lane Date: Wed, 30 Nov 2011 05:37:14 +0000 (-0500) Subject: Tweak previous patch to ensure edata->filename always gets initialized. X-Git-Tag: REL9_1_2~7 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b2b1220dee279e9981bf8bf0e1e01e65bffe373c;p=postgresql 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. --- diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index 8471d92f57..fee69dfc17 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -348,8 +348,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 */ @@ -1154,8 +1156,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 */