aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/varlena.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2012-09-06 11:43:51 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2012-09-06 11:43:51 -0400
commitd2286a98ef3fb88bafb57381b4c20b8b878827f1 (patch)
tree1c5eba9b09154ecad3db11aeaa195cd1bcd1f00c /src/backend/utils/adt/varlena.c
parent25f4fe4e461072a0371dc6d6cedbf08a04477fcd (diff)
downloadpostgresql-d2286a98ef3fb88bafb57381b4c20b8b878827f1.tar.gz
postgresql-d2286a98ef3fb88bafb57381b4c20b8b878827f1.zip
Allow embedded spaces without quoting in unix_socket_directories entries.
This fix removes an unnecessary incompatibility with the old behavior of the unix_socket_directory parameter. Since pathnames with embedded spaces are fairly popular on some platforms, the incompatibility could be significant in practice. We'll still strip unquoted leading/trailing spaces, however. No docs update since the documentation already implied that it worked like this. Per bug #7514 from Murray Cumming.
Diffstat (limited to 'src/backend/utils/adt/varlena.c')
-rw-r--r--src/backend/utils/adt/varlena.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c
index d9e6bc4338b..7e7d8c73bcf 100644
--- a/src/backend/utils/adt/varlena.c
+++ b/src/backend/utils/adt/varlena.c
@@ -2451,9 +2451,9 @@ SplitIdentifierString(char *rawstring, char separator,
*
* This is similar to SplitIdentifierString, except that the parsing
* rules are meant to handle pathnames instead of identifiers: there is
- * no downcasing, the max length is MAXPGPATH-1, and we apply
- * canonicalize_path() to each extracted string. Because of the last,
- * the returned strings are separately palloc'd rather than being
+ * no downcasing, embedded spaces are allowed, the max length is MAXPGPATH-1,
+ * and we apply canonicalize_path() to each extracted string. Because of the
+ * last, the returned strings are separately palloc'd rather than being
* pointers into rawstring --- but we still scribble on rawstring.
*
* Inputs:
@@ -2510,13 +2510,16 @@ SplitDirectoriesString(char *rawstring, char separator,
}
else
{
- /* Unquoted name --- extends to separator or whitespace */
- curname = nextp;
- while (*nextp && *nextp != separator &&
- !isspace((unsigned char) *nextp))
+ /* Unquoted name --- extends to separator or end of string */
+ curname = endp = nextp;
+ while (*nextp && *nextp != separator)
+ {
+ /* trailing whitespace should not be included in name */
+ if (!isspace((unsigned char) *nextp))
+ endp = nextp + 1;
nextp++;
- endp = nextp;
- if (curname == nextp)
+ }
+ if (curname == endp)
return false; /* empty unquoted name not allowed */
}