Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
3b0ee862
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,发现更多精彩内容 >>
提交
3b0ee862
编写于
8月 12, 2005
作者:
B
Bruce Momjian
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Reverse out changes to canonicalize_path(), per suggestion from Tom.
上级
35379e90
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
21 addition
and
59 deletion
+21
-59
src/backend/postmaster/postmaster.c
src/backend/postmaster/postmaster.c
+3
-6
src/port/Makefile
src/port/Makefile
+2
-3
src/port/path.c
src/port/path.c
+16
-50
未找到文件。
src/backend/postmaster/postmaster.c
浏览文件 @
3b0ee862
...
...
@@ -37,7 +37,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.46
5 2005/08/12 19:42:44
momjian Exp $
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.46
6 2005/08/12 19:43:31
momjian Exp $
*
* NOTES
*
...
...
@@ -377,11 +377,8 @@ PostmasterMain(int argc, char *argv[])
char
*
userDoption
=
NULL
;
int
i
;
if
((
progname
=
get_progname
(
argv
[
0
]))
==
NULL
)
{
printf
(
_
(
"unable to allocate memory for program name
\"
%s
\"
.
\n
"
),
progname
);
ExitPostmaster
(
0
);
}
/* This will call exit() if strdup() fails. */
progname
=
get_progname
(
argv
[
0
]);
MyProcPid
=
PostmasterPid
=
getpid
();
...
...
src/port/Makefile
浏览文件 @
3b0ee862
...
...
@@ -15,7 +15,7 @@
# for use only by the backend binaries
#
# IDENTIFICATION
# $PostgreSQL: pgsql/src/port/Makefile,v 1.2
6 2005/08/12 19:42:45
momjian Exp $
# $PostgreSQL: pgsql/src/port/Makefile,v 1.2
7 2005/08/12 19:43:31
momjian Exp $
#
#-------------------------------------------------------------------------
...
...
@@ -31,7 +31,6 @@ LIBOBJS_SRV := $(LIBOBJS)
LIBOBJS_SRV
:=
$(
patsubst
dirmod.o,dirmod_srv.o,
$(LIBOBJS_SRV)
)
LIBOBJS_SRV
:=
$(
patsubst
exec.o,exec_srv.o,
$(LIBOBJS_SRV)
)
LIBOBJS_SRV
:=
$(
patsubst
getaddrinfo.o,getaddrinfo_srv.o,
$(LIBOBJS_SRV)
)
LIBOBJS_SRV
:=
$(
patsubst
path.o,path_srv.o,
$(LIBOBJS_SRV)
)
LIBOBJS_SRV
:=
$(
patsubst
thread.o,thread_srv.o,
$(LIBOBJS_SRV)
)
all
:
libpgport.a libpgport_srv.a
...
...
@@ -67,7 +66,7 @@ exec_srv.o: exec.c
getaddrinfo_srv.o
:
getaddrinfo.c
$(CC)
$(CFLAGS)
$(
subst
-DFRONTEND
,,
$(CPPFLAGS)
)
-c
$<
-o
$@
path_srv.o
:
path
.c
snprintf_srv.o
:
snprintf
.c
$(CC)
$(CFLAGS)
$(
subst
-DFRONTEND
,,
$(CPPFLAGS)
)
-c
$<
-o
$@
# No thread flags for server version
...
...
src/port/path.c
浏览文件 @
3b0ee862
...
...
@@ -8,16 +8,12 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/port/path.c,v 1.5
5 2005/08/12 19:42:45
momjian Exp $
* $PostgreSQL: pgsql/src/port/path.c,v 1.5
6 2005/08/12 19:43:32
momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef FRONTEND
#include "postgres.h"
#else
#include "postgres_fe.h"
#endif
#include "c.h"
#include <ctype.h>
#include <sys/stat.h>
...
...
@@ -230,7 +226,6 @@ canonicalize_path(char *path)
{
char
*
p
,
*
to_p
;
bool
was_sep
=
false
;
int
pending_strips
=
0
;
#ifdef WIN32
/*
...
...
@@ -289,38 +284,19 @@ canonicalize_path(char *path)
if
(
len
>
2
&&
strcmp
(
path
+
len
-
2
,
"/."
)
==
0
)
trim_directory
(
path
);
else
if
(
len
>
3
&&
strcmp
(
path
+
len
-
3
,
"/.."
)
==
0
)
/*
* Process only a single trailing "..", and only if ".." does
* not preceed it.
* So, we only deal with "/usr/local/..", not with "/usr/local/../..".
* We don't handle the even more complex cases, like
* "usr/local/../../..".
*/
else
if
(
len
>
3
&&
strcmp
(
path
+
len
-
3
,
"/.."
)
==
0
&&
(
len
!=
5
||
strcmp
(
path
,
"../.."
)
!=
0
)
&&
(
len
<
6
||
strcmp
(
path
+
len
-
6
,
"/../.."
)
!=
0
))
{
trim_directory
(
path
);
pending_strips
++
;
}
else
if
(
pending_strips
>
0
)
{
/* If path is not "", we can keep trimming. Even if path is
* "/", we can keep trimming because trim_directory never removes
* the leading separator, and the parent directory of "/" is "/".
*/
if
(
*
path
!=
'\0'
)
{
trim_directory
(
path
);
pending_strips
--
;
}
else
{
/*
* If we still have pending_strips, it means the supplied path
* was exhausted and we still have more directories to move up.
* This means that the resulting path is only parents, like
* ".." or "../..". If so, callers can not handle trailing "..",
* so we exit.
*/
#ifndef FRONTEND
elog
(
ERROR
,
"relative paths (
\"
..
\"
) not supported"
);
#else
fprintf
(
stderr
,
_
(
"relative paths (
\"
..
\"
) not supported
\n
"
));
exit
(
1
);
#endif
}
trim_directory
(
path
);
/* remove directory above */
}
else
break
;
...
...
@@ -329,10 +305,8 @@ canonicalize_path(char *path)
/*
* Extracts the actual name of the program as called -
* stripped of .exe suffix if any.
* The server calling this must check for NULL return
* and report the error.
* Extracts the actual name of the program as called -
* stripped of .exe suffix if any
*/
const
char
*
get_progname
(
const
char
*
argv0
)
...
...
@@ -355,16 +329,8 @@ get_progname(const char *argv0)
progname
=
strdup
(
nodir_name
);
if
(
progname
==
NULL
)
{
#ifndef FRONTEND
/*
* No elog() support in postmaster at this stage,
* so return NULL and print error at the call.
*/
return
NULL
;
#else
fprintf
(
stderr
,
"%s: out of memory
\n
"
,
nodir_name
);
exit
(
1
);
#endif
exit
(
1
);
/* This could exit the postmaster */
}
progname
[
strlen
(
progname
)
-
(
sizeof
(
EXE
)
-
1
)]
=
'\0'
;
nodir_name
=
progname
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录