From: Tom Lane Date: Wed, 30 Nov 2011 05:37:33 +0000 (-0500) Subject: Tweak previous patch to ensure edata->filename always gets initialized. X-Git-Tag: REL8_3_17~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ed30dff211c988622d1ff43f5de2b5821a961980;p=thirdparty%2Fpostgresql.git 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 9a388f0f3b1..7e60fd4ae0d 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -319,8 +319,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; /* Select default errcode based on elevel */ @@ -963,8 +965,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 */