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

Commit 27eeca5

Browse files
committed
For GUC values, check for partial string matches on 'on' and 'off', but
require at least two characters for uniqueness. This now matches the behavior of other boolean strings we support, per report from Gurjeet Singh.
1 parent a78fcfb commit 27eeca5

File tree

1 file changed

+4
-3
lines changed
  • src/backend/utils/misc

1 file changed

+4
-3
lines changed

src/backend/utils/misc/guc.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Written by Peter Eisentraut <peter_e@gmx.net>.
1111
*
1212
* IDENTIFICATION
13-
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.362 2006/12/13 05:54:48 tgl Exp $
13+
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.363 2006/12/23 00:52:40 momjian Exp $
1414
*
1515
*--------------------------------------------------------------------
1616
*/
@@ -3575,12 +3575,13 @@ parse_bool(const char *value, bool *result)
35753575
*result = false;
35763576
}
35773577

3578-
else if (pg_strcasecmp(value, "on") == 0)
3578+
/* 'o' is not unique enough */
3579+
else if (pg_strncasecmp(value, "on", (len > 2 ? len : 2)) == 0)
35793580
{
35803581
if (result)
35813582
*result = true;
35823583
}
3583-
else if (pg_strcasecmp(value, "off") == 0)
3584+
else if (pg_strncasecmp(value, "off", (len > 2 ? len : 2)) == 0)
35843585
{
35853586
if (result)
35863587
*result = false;

0 commit comments

Comments
 (0)