|
4 | 4 | *
|
5 | 5 | * Copyright (c) 2000-2009, PostgreSQL Global Development Group
|
6 | 6 | *
|
7 |
| - * $PostgreSQL: pgsql/src/backend/utils/misc/guc-file.l,v 1.62 2009/10/03 18:04:57 tgl Exp $ |
| 7 | + * $PostgreSQL: pgsql/src/backend/utils/misc/guc-file.l,v 1.63 2009/11/12 18:20:23 tgl Exp $ |
8 | 8 | */
|
9 | 9 |
|
10 | 10 | %{
|
@@ -316,18 +316,33 @@ ProcessConfigFile(GucContext context)
|
316 | 316 |
|
317 | 317 | /* In SIGHUP cases in the postmaster, report changes */
|
318 | 318 | if (context == PGC_SIGHUP && !IsUnderPostmaster)
|
319 |
| - pre_value = pstrdup(GetConfigOption(item->name, false)); |
| 319 | + { |
| 320 | + const char *preval = GetConfigOption(item->name, false); |
| 321 | + |
| 322 | + /* string variables could be NULL; treat that as empty */ |
| 323 | + if (!preval) |
| 324 | + preval = ""; |
| 325 | + /* must dup, else might have dangling pointer below */ |
| 326 | + pre_value = pstrdup(preval); |
| 327 | + } |
320 | 328 |
|
321 | 329 | if (set_config_option(item->name, item->value, context,
|
322 | 330 | PGC_S_FILE, GUC_ACTION_SET, true))
|
323 | 331 | {
|
324 | 332 | set_config_sourcefile(item->name, item->filename,
|
325 | 333 | item->sourceline);
|
326 |
| - if (pre_value && |
327 |
| - strcmp(pre_value, GetConfigOption(item->name, false)) != 0) |
328 |
| - ereport(elevel, |
329 |
| - (errmsg("parameter \"%s\" changed to \"%s\"", |
330 |
| - item->name, item->value))); |
| 334 | + |
| 335 | + if (pre_value) |
| 336 | + { |
| 337 | + const char *post_value = GetConfigOption(item->name, false); |
| 338 | + |
| 339 | + if (!post_value) |
| 340 | + post_value = ""; |
| 341 | + if (strcmp(pre_value, post_value) != 0) |
| 342 | + ereport(elevel, |
| 343 | + (errmsg("parameter \"%s\" changed to \"%s\"", |
| 344 | + item->name, item->value))); |
| 345 | + } |
331 | 346 | }
|
332 | 347 |
|
333 | 348 | if (pre_value)
|
|
0 commit comments