Parcourir la source

fix error cases in gethostbyaddr_r

EAI_MEMORY is not possible (but would not provide errno if it were)
and EAI_FAIL does not provide errno. treat the latter as EBADMSG to
match how it's handled in gethostbyname2_r (it indicates erroneous or
failure response from the nameserver).
Rich Felker il y a 2 ans
Parent
commit
dc9285ad1d
1 fichiers modifiés avec 3 ajouts et 2 suppressions
  1. 3 2
      src/network/gethostbyaddr_r.c

+ 3 - 2
src/network/gethostbyaddr_r.c

@@ -54,9 +54,10 @@ int gethostbyaddr_r(const void *a, socklen_t l, int af,
 	case EAI_OVERFLOW:
 		return ERANGE;
 	default:
-	case EAI_MEMORY:
-	case EAI_SYSTEM:
 	case EAI_FAIL:
+		*err = NO_RECOVERY;
+		return EBADMSG;
+	case EAI_SYSTEM:
 		*err = NO_RECOVERY;
 		return errno;
 	case 0: