mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-01-24 18:55:04 +08:00
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.
This commit is contained in:
parent
25f4fe4e46
commit
d2286a98ef
@ -2451,9 +2451,9 @@ SplitIdentifierString(char *rawstring, char separator,
|
|||||||
*
|
*
|
||||||
* This is similar to SplitIdentifierString, except that the parsing
|
* This is similar to SplitIdentifierString, except that the parsing
|
||||||
* rules are meant to handle pathnames instead of identifiers: there is
|
* rules are meant to handle pathnames instead of identifiers: there is
|
||||||
* no downcasing, the max length is MAXPGPATH-1, and we apply
|
* no downcasing, embedded spaces are allowed, the max length is MAXPGPATH-1,
|
||||||
* canonicalize_path() to each extracted string. Because of the last,
|
* and we apply canonicalize_path() to each extracted string. Because of the
|
||||||
* the returned strings are separately palloc'd rather than being
|
* last, the returned strings are separately palloc'd rather than being
|
||||||
* pointers into rawstring --- but we still scribble on rawstring.
|
* pointers into rawstring --- but we still scribble on rawstring.
|
||||||
*
|
*
|
||||||
* Inputs:
|
* Inputs:
|
||||||
@ -2510,13 +2510,16 @@ SplitDirectoriesString(char *rawstring, char separator,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Unquoted name --- extends to separator or whitespace */
|
/* Unquoted name --- extends to separator or end of string */
|
||||||
curname = nextp;
|
curname = endp = nextp;
|
||||||
while (*nextp && *nextp != separator &&
|
while (*nextp && *nextp != separator)
|
||||||
!isspace((unsigned char) *nextp))
|
{
|
||||||
|
/* trailing whitespace should not be included in name */
|
||||||
|
if (!isspace((unsigned char) *nextp))
|
||||||
|
endp = nextp + 1;
|
||||||
nextp++;
|
nextp++;
|
||||||
endp = nextp;
|
}
|
||||||
if (curname == nextp)
|
if (curname == endp)
|
||||||
return false; /* empty unquoted name not allowed */
|
return false; /* empty unquoted name not allowed */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user