]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Return different exit codes when gai_result is > -100
authorPetr Menšík <pemensik@redhat.com>
Thu, 16 Oct 2025 14:18:23 +0000 (16:18 +0200)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Thu, 30 Apr 2026 13:52:59 +0000 (10:52 -0300)
Make the result checkable from the command line even without verbose
mode. Keep original exit status 2 for name not found error. But report
other errors by exit status greater than 10.

For too high values make it return 2 as before.

Signed-off-by: Petr Menšík <pemensik@redhat.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
nss/getent.c

index 7e78edabdf6fe2adb146a3f529678b5d1ba67b4b..d591b7ac0bde8d781ae96544ba9453f604cbe060 100644 (file)
@@ -368,10 +368,13 @@ ahosts_keys_int (int af, int xflags, int number, char *key[])
 
       if (gai_result != 0)
        {
-         result = 2;
          if (gai_verbose)
            fprintf (stderr, _("Host %s failed: %s\n"), key[i],
                            gai_strerror (gai_result));
+         if (gai_result >= EAI_INPROGRESS && gai_result != EAI_NONAME)
+           result = 10 + abs (gai_result);
+         else
+           result = 2;
        }
       else
        {