chiark / gitweb /
tolerate libc giving NONAME when we have more subtle answer
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 28 May 2014 22:10:51 +0000 (23:10 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 28 May 2014 22:10:51 +0000 (23:10 +0100)
client/addrtext.c

index 950d901ead200183ac8821caca003b69dc03959e..136de26ddf6d23babf83daba098500e891890000 100644 (file)
@@ -124,9 +124,19 @@ static void dotest(const char *input) {
           air->ai_family, (long)air->ai_addrlen, air->ai_addr, air->ai_next);
   printf(":");
 
-  if (our_r==EINVAL && libc_r==EAI_NONAME && !air) {
-    printf(" invalid");
-    goto ok;
+  if (libc_r==EAI_NONAME && !air) {
+    if (strchr(input,'%') && (our_r==ENOSYS || our_r==ENXIO)) {
+      printf(" bad-scope");
+      goto ok;
+    }
+    if (strchr(input,'%') && our_r==ENOSYS) {
+      printf(" bad-scope");
+      goto ok;
+    }
+    if (our_r==EINVAL) {
+      printf(" invalid");
+      goto ok;
+    }
   }
   printf(" valid");