diff options
author | wtc%netscape.com <devnull@localhost> | 2000-02-15 00:12:56 +0000 |
---|---|---|
committer | wtc%netscape.com <devnull@localhost> | 2000-02-15 00:12:56 +0000 |
commit | 224ca6b93976fb443425ea880e84356d91dab18b (patch) | |
tree | 17a6aad63ac1517ad3d73a46f0f8adaa8010e431 | |
parent | 2d43f6b2ad47bc60d72a328b07adb1bbdd8d3476 (diff) | |
download | nspr-hg-224ca6b93976fb443425ea880e84356d91dab18b.tar.gz |
Bugzilla bug #25127: removed the use of 'errno' because ENOSPC is not
defined on the Mac. We don't really need to set or test 'errno'
because inet_ntop and V6AddrToString only have one reason of failure
(not enough space in the result buffer).
(NSPRPUB_RELEASE_4_0_BRANCH)
-rw-r--r-- | pr/src/misc/prnetdb.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/pr/src/misc/prnetdb.c b/pr/src/misc/prnetdb.c index 4cf63e9d..a1e3952a 100644 --- a/pr/src/misc/prnetdb.c +++ b/pr/src/misc/prnetdb.c @@ -1185,13 +1185,14 @@ static const char *basis_hex = "0123456789abcdef"; /* * V6AddrToString() returns a pointer to the buffer containing * the text string if the conversion succeeds, and NULL otherwise. - * (Same as inet_ntop(AF_INET6, addr, buf, size).) + * (Same as inet_ntop(AF_INET6, addr, buf, size), except that errno + * is not set on failure.) */ static const char *V6AddrToString( const PRIPv6Addr *addr, char *buf, PRUint32 size) { #define STUFF(c) do { \ - if (!size--) goto failed; \ + if (!size--) return NULL; \ *buf++ = (c); \ } while (0) @@ -1282,10 +1283,6 @@ static const char *V6AddrToString( } STUFF('\0'); return bufcopy; - -failed: - errno = ENOSPC; /* the size of the result buffer is inadequate */ - return NULL; #undef STUFF } @@ -1355,7 +1352,8 @@ PR_IMPLEMENT(PRStatus) PR_NetAddrToString( if (NULL == V6AddrToString(&addr->ipv6.ip, string, size)) #endif { - PR_SetError(PR_BUFFER_OVERFLOW_ERROR, errno); + /* the size of the result buffer is inadequate */ + PR_SetError(PR_BUFFER_OVERFLOW_ERROR, 0); return PR_FAILURE; } } |