summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/Instance.cpp
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2017-11-17 13:46:59 +0100
committerJose <jose@zeroc.com>2017-11-17 13:46:59 +0100
commit21f5c77fc305ea1441b069753b0467fc145f6547 (patch)
tree811028bf050e56cc948580b98a18f3e585ec473e /cpp/src/Ice/Instance.cpp
parentDo not set sourceCompatibility when building tests (diff)
downloadice-21f5c77fc305ea1441b069753b0467fc145f6547.tar.bz2
ice-21f5c77fc305ea1441b069753b0467fc145f6547.tar.xz
ice-21f5c77fc305ea1441b069753b0467fc145f6547.zip
getpwnam_r bogus loop
Bug ICE-8659 See also https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=875714#24
Diffstat (limited to 'cpp/src/Ice/Instance.cpp')
-rw-r--r--cpp/src/Ice/Instance.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/cpp/src/Ice/Instance.cpp b/cpp/src/Ice/Instance.cpp
index 2e6ea32af08..35b8a7bbc28 100644
--- a/cpp/src/Ice/Instance.cpp
+++ b/cpp/src/Ice/Instance.cpp
@@ -1017,8 +1017,9 @@ IceInternal::Instance::Instance(const CommunicatorPtr& communicator, const Initi
struct passwd pwbuf;
vector<char> buffer(4096); // 4KB initial buffer
struct passwd *pw;
- int err = getpwnam_r(newUser.c_str(), &pwbuf, &buffer[0], buffer.size(), &pw);
- while(err == ERANGE && buffer.size() < 1024 * 1024) // Limit buffer to 1MB
+ int err;
+ while((err = getpwnam_r(newUser.c_str(), &pwbuf, &buffer[0], buffer.size(), &pw)) == ERANGE &&
+ buffer.size() < 1024 * 1024) // Limit buffer to 1M
{
buffer.resize(buffer.size() * 2);
}