diff options
author | Tom Lane | 2011-11-30 05:37:20 +0000 |
---|---|---|
committer | Tom Lane | 2011-11-30 05:37:20 +0000 |
commit | b06c6f52d02f58a3144947a70a92c3ab25878ec0 (patch) | |
tree | f98d9af83d00546e3628af5b9448b17736ef8c3b | |
parent | 75b61836940aaa81f3073c7e77f8c295d99093ae (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.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index 49ce20112ff..ae5b9c88daa 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -341,8 +341,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 */ @@ -1116,8 +1118,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 */ |