1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-29 10:41:53 +03:00

Also escape double quotes for ECPG's #line statement.

This commit is contained in:
Michael Meskes
2013-07-06 22:08:53 +02:00
parent 0cd787802f
commit 43c3aab123

View File

@ -95,7 +95,7 @@ hashline_number(void)
#endif #endif
) )
{ {
/* "* 2" here is for escaping \s below */ /* "* 2" here is for escaping '\' and '"' below */
char *line = mm_alloc(strlen("\n#line %d \"%s\"\n") + sizeof(int) * CHAR_BIT * 10 / 3 + strlen(input_filename) * 2); char *line = mm_alloc(strlen("\n#line %d \"%s\"\n") + sizeof(int) * CHAR_BIT * 10 / 3 + strlen(input_filename) * 2);
char *src, char *src,
*dest; *dest;
@ -105,7 +105,7 @@ hashline_number(void)
dest = line + strlen(line); dest = line + strlen(line);
while (*src) while (*src)
{ {
if (*src == '\\') if (*src == '\\' || *src == '"')
*dest++ = '\\'; *dest++ = '\\';
*dest++ = *src++; *dest++ = *src++;
} }