You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by se...@apache.org on 2017/08/18 23:03:33 UTC
[1/2] incubator-trafodion git commit: [TRAFODION-2709] getpwuid is
not a Thread-safe function
Repository: incubator-trafodion
Updated Branches:
refs/heads/master a7a9b0f6b -> dec408b9b
[TRAFODION-2709] getpwuid is not a Thread-safe function
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/ba880338
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/ba880338
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/ba880338
Branch: refs/heads/master
Commit: ba880338077efa5a1c6753ab5fe16888e98df1c9
Parents: 1b835a6
Author: Weixin-Xu <xw...@weixin-1.novalocal>
Authored: Fri Aug 11 17:21:17 2017 +0800
Committer: Weixin-Xu <xw...@weixin-1.novalocal>
Committed: Fri Aug 11 17:21:17 2017 +0800
----------------------------------------------------------------------
.../unixodbc/odbc/odbcclient/unixcli/cli/cconnect.cpp | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/ba880338/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/cconnect.cpp
----------------------------------------------------------------------
diff --git a/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/cconnect.cpp b/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/cconnect.cpp
index 7fa0bb2..7960b42 100644
--- a/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/cconnect.cpp
+++ b/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/cconnect.cpp
@@ -623,6 +623,7 @@ SQLRETURN CConnect::Connect(SQLCHAR *ServerName,
BOOL readDSN)
{
char buffer[256];
+ char pwdbuffer[256] = {0};
char *lasts;
short retCode = SQL_SUCCESS;
HWND currentWindow;
@@ -973,11 +974,12 @@ SQLRETURN CConnect::Connect(SQLCHAR *ServerName,
return SQL_ERROR;
// Get client user name.
- struct passwd *passwd; /* man getpwuid */
- passwd = getpwuid (getuid()); /* Get the uid of the running processand use it to get a record from /etc/passwd */
- if (strlen(passwd->pw_name) > 0)
+ struct passwd passwd; /* man getpwuid */
+ memset(&passwd,'\0',sizeof(struct passwd));
+ struct passwd* tempPwdPtr;
+ if((getpwuid_r(getuid(),&passwd,pwdbuffer,sizeof(pwdbuffer),&tempPwdPtr)) == 0)
{
- inContext.clientUserName = passwd->pw_name;
+ inContext.clientUserName = passwd.pw_name;
inContext.inContextOptions1 = inContext.inContextOptions1 | INCONTEXT_OPT1_CLIENT_USERNAME;
}
else
[2/2] incubator-trafodion git commit: Merge PR 1201 [TRAFODION-2709]
getpwuid is not a Thread-safe function]
Posted by se...@apache.org.
Merge PR 1201 [TRAFODION-2709] getpwuid is not a Thread-safe function]
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/dec408b9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/dec408b9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/dec408b9
Branch: refs/heads/master
Commit: dec408b9b9c2f77400256def394626ac582abb58
Parents: a7a9b0f ba88033
Author: selvaganesang <se...@apache.org>
Authored: Fri Aug 18 23:02:52 2017 +0000
Committer: selvaganesang <se...@apache.org>
Committed: Fri Aug 18 23:02:52 2017 +0000
----------------------------------------------------------------------
.../unixodbc/odbc/odbcclient/unixcli/cli/cconnect.cpp | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/dec408b9/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/cconnect.cpp
----------------------------------------------------------------------