Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
6a640d1e
G
Gpdb
项目概览
Greenplum
/
Gpdb
通知
7
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Gpdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
6a640d1e
编写于
10月 07, 2004
作者:
T
Tom Lane
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add missing null terminator to escaped string; clean up unnecessarily
obscurantist coding conventions.
上级
0c657baa
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
16 addition
and
16 deletion
+16
-16
src/bin/initdb/initdb.c
src/bin/initdb/initdb.c
+16
-16
未找到文件。
src/bin/initdb/initdb.c
浏览文件 @
6a640d1e
...
@@ -39,7 +39,7 @@
...
@@ -39,7 +39,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 1994, Regents of the University of California
* Portions taken from FreeBSD.
* Portions taken from FreeBSD.
*
*
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.5
8 2004/10/07 17:29:12 momjian
Exp $
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.5
9 2004/10/07 18:57:26 tgl
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -181,7 +181,7 @@ static void vacuum_db(void);
...
@@ -181,7 +181,7 @@ static void vacuum_db(void);
static
void
make_template0
(
void
);
static
void
make_template0
(
void
);
static
void
trapsig
(
int
signum
);
static
void
trapsig
(
int
signum
);
static
void
check_ok
(
void
);
static
void
check_ok
(
void
);
static
void
escape_locale
(
char
**
locale
);
static
char
*
escape_quotes
(
const
char
*
src
);
static
bool
chklocale
(
const
char
*
locale
);
static
bool
chklocale
(
const
char
*
locale
);
static
void
setlocales
(
void
);
static
void
setlocales
(
void
);
static
void
usage
(
const
char
*
progname
);
static
void
usage
(
const
char
*
progname
);
...
@@ -1100,20 +1100,19 @@ setup_config(void)
...
@@ -1100,20 +1100,19 @@ setup_config(void)
snprintf
(
repltok
,
sizeof
(
repltok
),
"shared_buffers = %d"
,
n_buffers
);
snprintf
(
repltok
,
sizeof
(
repltok
),
"shared_buffers = %d"
,
n_buffers
);
conflines
=
replace_token
(
conflines
,
"#shared_buffers = 1000"
,
repltok
);
conflines
=
replace_token
(
conflines
,
"#shared_buffers = 1000"
,
repltok
);
lc_messages
=
escape_quotes
(
lc_messages
);
escape_locale
(
&
lc_messages
);
snprintf
(
repltok
,
sizeof
(
repltok
),
"lc_messages = '%s'"
,
lc_messages
);
snprintf
(
repltok
,
sizeof
(
repltok
),
"lc_messages = '%s'"
,
lc_messages
);
conflines
=
replace_token
(
conflines
,
"#lc_messages = 'C'"
,
repltok
);
conflines
=
replace_token
(
conflines
,
"#lc_messages = 'C'"
,
repltok
);
escape_locale
(
&
lc_monetary
);
lc_monetary
=
escape_quotes
(
lc_monetary
);
snprintf
(
repltok
,
sizeof
(
repltok
),
"lc_monetary = '%s'"
,
lc_monetary
);
snprintf
(
repltok
,
sizeof
(
repltok
),
"lc_monetary = '%s'"
,
lc_monetary
);
conflines
=
replace_token
(
conflines
,
"#lc_monetary = 'C'"
,
repltok
);
conflines
=
replace_token
(
conflines
,
"#lc_monetary = 'C'"
,
repltok
);
escape_locale
(
&
lc_numeric
);
lc_numeric
=
escape_quotes
(
lc_numeric
);
snprintf
(
repltok
,
sizeof
(
repltok
),
"lc_numeric = '%s'"
,
lc_numeric
);
snprintf
(
repltok
,
sizeof
(
repltok
),
"lc_numeric = '%s'"
,
lc_numeric
);
conflines
=
replace_token
(
conflines
,
"#lc_numeric = 'C'"
,
repltok
);
conflines
=
replace_token
(
conflines
,
"#lc_numeric = 'C'"
,
repltok
);
escape_locale
(
&
lc_time
);
lc_time
=
escape_quotes
(
lc_time
);
snprintf
(
repltok
,
sizeof
(
repltok
),
"lc_time = '%s'"
,
lc_time
);
snprintf
(
repltok
,
sizeof
(
repltok
),
"lc_time = '%s'"
,
lc_time
);
conflines
=
replace_token
(
conflines
,
"#lc_time = 'C'"
,
repltok
);
conflines
=
replace_token
(
conflines
,
"#lc_time = 'C'"
,
repltok
);
...
@@ -1902,22 +1901,23 @@ check_ok()
...
@@ -1902,22 +1901,23 @@ check_ok()
}
}
/*
/*
* Escape any single quotes or backslashes in
locale
* Escape any single quotes or backslashes in
given string
*/
*/
static
void
static
char
*
escape_
locale
(
char
**
locale
)
escape_
quotes
(
const
char
*
src
)
{
{
int
len
=
strlen
(
*
locale
),
int
len
=
strlen
(
src
),
i
,
j
;
i
,
j
;
char
*
loc_temp
=
xmalloc
(
len
*
2
+
1
);
char
*
result
=
xmalloc
(
len
*
2
+
1
);
for
(
i
=
0
,
j
=
0
;
i
<
len
;
i
++
)
for
(
i
=
0
,
j
=
0
;
i
<
len
;
i
++
)
{
{
if
(
(
*
locale
)[
i
]
==
'\''
||
(
*
locale
)
[
i
]
==
'\\'
)
if
(
src
[
i
]
==
'\''
||
src
[
i
]
==
'\\'
)
loc_temp
[
j
++
]
=
'\\'
;
result
[
j
++
]
=
'\\'
;
loc_temp
[
j
++
]
=
(
*
locale
)
[
i
];
result
[
j
++
]
=
src
[
i
];
}
}
*
locale
=
loc_temp
;
result
[
j
]
=
'\0'
;
return
result
;
}
}
/*
/*
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录