Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 7 Feb 2014 15:26:19 +0000 (UTC)
From:      Kevin Lo <kevlo@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r261602 - head/lib/libc/inet
Message-ID:  <201402071526.s17FQJb0077806@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kevlo
Date: Fri Feb  7 15:26:19 2014
New Revision: 261602
URL: http://svnweb.freebsd.org/changeset/base/261602

Log:
  Set errno on inet_ntop(3) failure.
  
  Reviewed by:	glebius

Modified:
  head/lib/libc/inet/inet_ntop.c

Modified: head/lib/libc/inet/inet_ntop.c
==============================================================================
--- head/lib/libc/inet/inet_ntop.c	Fri Feb  7 15:18:23 2014	(r261601)
+++ head/lib/libc/inet/inet_ntop.c	Fri Feb  7 15:26:19 2014	(r261602)
@@ -45,7 +45,7 @@ __FBSDID("$FreeBSD$");
 static const char *inet_ntop4(const u_char *src, char *dst, socklen_t size);
 static const char *inet_ntop6(const u_char *src, char *dst, socklen_t size);
 
-/* char *
+/* const char *
  * inet_ntop(af, src, dst, size)
  *	convert a network format address to presentation format.
  * return:
@@ -169,8 +169,10 @@ inet_ntop6(const u_char *src, char *dst,
 		if (i == 6 && best.base == 0 && (best.len == 6 ||
 		    (best.len == 7 && words[7] != 0x0001) ||
 		    (best.len == 5 && words[5] == 0xffff))) {
-			if (!inet_ntop4(src+12, tp, sizeof tmp - (tp - tmp)))
+			if (!inet_ntop4(src+12, tp, sizeof tmp - (tp - tmp))) {
+				errno = ENOSPC;
 				return (NULL);
+			}
 			tp += strlen(tp);
 			break;
 		}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201402071526.s17FQJb0077806>