Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
80c1e822
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,发现更多精彩内容 >>
提交
80c1e822
编写于
11月 17, 1997
作者:
T
Thomas G. Lockhart
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Unscramble port selection logic to avoid compiler complaints about
uninitialized variables. I _think_ the logic is preserved...
上级
c2f4779d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
31 addition
and
33 deletion
+31
-33
src/interfaces/libpq/fe-connect.c
src/interfaces/libpq/fe-connect.c
+31
-33
未找到文件。
src/interfaces/libpq/fe-connect.c
浏览文件 @
80c1e822
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.4
6 1997/11/14 15:38:31
thomas Exp $
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.4
7 1997/11/17 16:42:39
thomas Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -350,49 +350,43 @@ PQsetdb(const char *pghost, const char *pgport, const char *pgoptions, const cha
conn
->
port
=
NULL
;
conn
->
notifyList
=
DLNewList
();
if
(
!
pghost
||
pghost
[
0
]
==
'\0'
)
if
(
(
pghost
==
NULL
)
||
pghost
[
0
]
==
'\0'
)
{
conn
->
pghost
=
NULL
;
if
(
tmp
=
getenv
(
"PGHOST"
)
)
if
(
(
tmp
=
getenv
(
"PGHOST"
))
!=
NULL
)
conn
->
pghost
=
strdup
(
tmp
);
}
else
conn
->
pghost
=
strdup
(
pghost
);
if
(
!
pgport
||
pgport
[
0
]
==
'\0'
)
if
(
(
pgport
==
NULL
)
||
pgport
[
0
]
==
'\0'
)
{
if
(
!
(
tmp
=
getenv
(
"PGPORT"
)))
{
if
((
tmp
=
getenv
(
"PGPORT"
))
==
NULL
)
tmp
=
DEF_PGPORT
;
}
conn
->
pgport
=
strdup
(
tmp
);
}
else
conn
->
pgport
=
strdup
(
pgport
);
if
(
!
pgtty
||
pgtty
[
0
]
==
'\0'
)
if
(
(
pgtty
==
NULL
)
||
pgtty
[
0
]
==
'\0'
)
{
if
(
!
(
tmp
=
getenv
(
"PGTTY"
)))
{
if
((
tmp
=
getenv
(
"PGTTY"
))
==
NULL
)
tmp
=
DefaultTty
;
}
conn
->
pgtty
=
strdup
(
tmp
);
}
else
conn
->
pgtty
=
strdup
(
pgtty
);
if
(
!
pgoptions
||
pgoptions
[
0
]
==
'\0'
)
if
(
(
pgoptions
==
NULL
)
||
pgoptions
[
0
]
==
'\0'
)
{
if
(
!
(
tmp
=
getenv
(
"PGOPTIONS"
)))
{
if
((
tmp
=
getenv
(
"PGOPTIONS"
))
==
NULL
)
tmp
=
DefaultOption
;
}
conn
->
pgoptions
=
strdup
(
tmp
);
}
else
conn
->
pgoptions
=
strdup
(
pgoptions
);
if
((
tmp
=
getenv
(
"PGUSER"
)))
if
((
tmp
=
getenv
(
"PGUSER"
))
!=
NULL
)
{
error
=
FALSE
;
conn
->
pguser
=
strdup
(
tmp
);
...
...
@@ -413,19 +407,15 @@ PQsetdb(const char *pghost, const char *pgport, const char *pgoptions, const cha
}
}
if
((
tmp
=
getenv
(
"PGPASSWORD"
)))
{
if
((
tmp
=
getenv
(
"PGPASSWORD"
))
!=
NULL
)
conn
->
pgpass
=
strdup
(
tmp
);
}
else
{
conn
->
pgpass
=
0
;
}
if
(
!
error
)
{
if
(((
tmp
=
(
char
*
)
dbName
)
&&
(
dbName
[
0
]
!=
'\0'
))
||
((
tmp
=
getenv
(
"PGDATABASE"
))))
if
(((
(
tmp
=
(
char
*
)
dbName
)
!=
NULL
)
&&
(
dbName
[
0
]
!=
'\0'
))
||
((
tmp
=
getenv
(
"PGDATABASE"
))))
conn
->
dbName
=
strdup
(
tmp
);
else
conn
->
dbName
=
strdup
(
conn
->
pguser
);
...
...
@@ -523,17 +513,25 @@ connectDB(PGconn *conn)
port
=
(
Port
*
)
malloc
(
sizeof
(
Port
));
MemSet
((
char
*
)
port
,
0
,
sizeof
(
Port
));
if
(
conn
->
pghost
&&
(
!
(
hp
=
gethostbyname
(
conn
->
pghost
))
||
hp
->
h_addrtype
!=
AF_INET
))
if
(
conn
->
pghost
!=
NULL
)
{
(
void
)
sprintf
(
conn
->
errorMessage
,
"connectDB() -- unknown hostname: %s
\n
"
,
conn
->
pghost
);
goto
connect_errReturn
;
}
hp
=
gethostbyname
(
conn
->
pghost
);
if
((
hp
==
NULL
)
||
(
hp
->
h_addrtype
!=
AF_INET
))
{
(
void
)
sprintf
(
conn
->
errorMessage
,
"connectDB() -- unknown hostname: %s
\n
"
,
conn
->
pghost
);
goto
connect_errReturn
;
}
}
else
hp
=
NULL
;
#if FALSE
MemSet
((
char
*
)
&
port
->
raddr
,
0
,
sizeof
(
port
->
raddr
));
#endif
portno
=
atoi
(
conn
->
pgport
);
port
->
raddr
.
in
.
sin_family
=
family
=
conn
->
pghost
?
AF_INET
:
AF_UNIX
;
family
=
(
conn
->
pghost
!=
NULL
)
?
AF_INET
:
AF_UNIX
;
port
->
raddr
.
in
.
sin_family
=
family
;
if
(
family
==
AF_INET
)
{
memmove
((
char
*
)
&
(
port
->
raddr
.
in
.
sin_addr
),
...
...
@@ -620,7 +618,7 @@ connectDB(PGconn *conn)
}
/* free the password so it's not hanging out in memory forever */
if
(
conn
->
pgpass
)
if
(
conn
->
pgpass
!=
NULL
)
{
free
(
conn
->
pgpass
);
}
...
...
@@ -628,7 +626,7 @@ connectDB(PGconn *conn)
/* set up the socket file descriptors */
conn
->
Pfout
=
fdopen
(
port
->
sock
,
"w"
);
conn
->
Pfin
=
fdopen
(
dup
(
port
->
sock
),
"r"
);
if
(
!
conn
->
Pfout
||
!
conn
->
Pfin
)
if
(
(
conn
->
Pfout
==
NULL
)
||
(
conn
->
Pfin
==
NULL
)
)
{
(
void
)
sprintf
(
conn
->
errorMessage
,
"connectDB() -- fdopen() failed: errno=%d
\n
%s
\n
"
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录