diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 1997-11-17 00:25:49 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 1997-11-17 00:25:49 +0000 |
commit | 3db078a3e445ba3d7341449a957f657c5d6e0f2f (patch) | |
tree | bf9aa20a3a02807d06f69aa24bd6a9556de7cfff /ace/SPIPE_Addr.cpp | |
parent | 8a758252bf031e8f1d21f4394849eb0f7c5aa487 (diff) | |
download | ATCD-3db078a3e445ba3d7341449a957f657c5d6e0f2f.tar.gz |
*** empty log message ***
Diffstat (limited to 'ace/SPIPE_Addr.cpp')
-rw-r--r-- | ace/SPIPE_Addr.cpp | 41 |
1 files changed, 28 insertions, 13 deletions
diff --git a/ace/SPIPE_Addr.cpp b/ace/SPIPE_Addr.cpp index 4edb38fc257..3e97a16aa0c 100644 --- a/ace/SPIPE_Addr.cpp +++ b/ace/SPIPE_Addr.cpp @@ -88,34 +88,49 @@ ACE_SPIPE_Addr::set (LPCTSTR addr, TCHAR *colonp = ACE_OS::strchr (addr, ':'); TCHAR temp[BUFSIZ]; - if (colonp == 0) // Assume it's a port number. + if (colonp == 0) // Assume it's a local name. { - ACE_OS::strcpy(temp, __TEXT ( "\\\\.\\pipe\\")); - ACE_OS::strcat(temp, addr); + ACE_OS::strcpy (temp, __TEXT ( "\\\\.\\pipe\\")); + ACE_OS::strcat (temp, addr); } else { - ACE_OS::strcpy(temp, __TEXT ("\\\\")); - *colonp = __TEXT ('\0'); - if (ACE_OS::strcmp(addr, __TEXT ("localhost")) == 0) - ACE_OS::strcat(temp, __TEXT (".")); // change localhost to . + + if (ACE_OS::strncmp (addr, + __TEXT ("localhost"), + ACE_OS::strlen ("localhost")) == 0) + // change "localhost" to "." + ACE_OS::strcpy (temp, __TEXT ("\\\\.")); else - ACE_OS::strcat(temp, addr); - ACE_OS::strcat(temp, __TEXT ("\\pipe\\")); - ACE_OS::strcat(temp, colonp+1); + { + ACE_OS::strcpy (temp, __TEXT ("\\\\")); + + TCHAR *t; + + // We need to allocate a duplicate so that we can write a + // NUL character into it. + ACE_ALLOCATOR_RETURN (t, ACE_OS::strdup (addr), -1); + + t[colonp - addr] = __TEXT ('\0'); + ACE_OS::strcpy (temp, t); + + ACE_OS::free (t); + } + + ACE_OS::strcat (temp, __TEXT ("\\pipe\\")); + ACE_OS::strcat (temp, colonp + 1); } this->ACE_Addr::base_set (AF_SPIPE, ACE_OS::strlen (temp) + len); - ACE_OS::strcpy(this->SPIPE_addr_.rendezvous_, temp) ; - + ACE_OS::strcpy (this->SPIPE_addr_.rendezvous_, temp); #else this->ACE_Addr::base_set (AF_SPIPE, ACE_OS::strlen (addr) + len); ACE_OS::strncpy (this->SPIPE_addr_.rendezvous_, addr, sizeof this->SPIPE_addr_.rendezvous_); -#endif +#endif /* ACE_WIN32 */ this->SPIPE_addr_.gid_ = gid == 0 ? ACE_OS::getgid () : gid; this->SPIPE_addr_.uid_ = uid == 0 ? ACE_OS::getuid () : uid; return 0; |