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

Commit a87ebac

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 dd13605 commit a87ebac

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/backend/utils/error/elog.c

+6-2
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,10 @@ errstart(int elevel, const char *filename, int lineno,
349349

350350
/* keep only base name, useful especially for vpath builds */
351351
slash = strrchr(filename, '/');
352-
edata->filename = slash ? slash + 1 : filename;
352+
if (slash)
353+
filename = slash + 1;
353354
}
355+
edata->filename = filename;
354356
edata->lineno = lineno;
355357
edata->funcname = funcname;
356358
/* the default text domain is the backend's */
@@ -1155,8 +1157,10 @@ elog_start(const char *filename, int lineno, const char *funcname)
11551157

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

0 commit comments

Comments
 (0)