Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit b2b1220

Browse files
committed
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.
1 parent 81a5068 commit b2b1220

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/backend/utils/error/elog.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,8 +348,10 @@ errstart(int elevel, const char *filename, int lineno,
348348

349349
/* keep only base name, useful especially for vpath builds */
350350
slash = strrchr(filename, '/');
351-
edata->filename = slash ? slash + 1 : filename;
351+
if (slash)
352+
filename = slash + 1;
352353
}
354+
edata->filename = filename;
353355
edata->lineno = lineno;
354356
edata->funcname = funcname;
355357
/* the default text domain is the backend's */
@@ -1154,8 +1156,10 @@ elog_start(const char *filename, int lineno, const char *funcname)
11541156

11551157
/* keep only base name, useful especially for vpath builds */
11561158
slash = strrchr(filename, '/');
1157-
edata->filename = slash ? slash + 1 : filename;
1159+
if (slash)
1160+
filename = slash + 1;
11581161
}
1162+
edata->filename = filename;
11591163
edata->lineno = lineno;
11601164
edata->funcname = funcname;
11611165
/* errno is saved now so that error parameter eval can't change it */

0 commit comments

Comments
 (0)