]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - c++tools/server.cc
[committed] Provide suitable output template for zero_extendqihi2 on H8
[thirdparty/gcc.git] / c++tools / server.cc
index 8c6ad314886e31a7e2052ad816bb3d199cf98adf..16237e7308f4d5afc7f6797fe39f7f3ad2f383c9 100644 (file)
@@ -1,5 +1,5 @@
 /* C++ modules.  Experimental!
-   Copyright (C) 2018-2022 Free Software Foundation, Inc.
+   Copyright (C) 2018-2024 Free Software Foundation, Inc.
    Written by Nathan Sidwell <nathan@acm.org> while at FaceBook
 
    This file is part of GCC.
@@ -319,7 +319,7 @@ static void ATTRIBUTE_NORETURN
 print_version (void)
 {
   fnotice (stdout, "%s %s%s\n", progname, pkgversion_string, version_string);
-  fprintf (stdout, "Copyright %s 2018-2022 Free Software Foundation, Inc.\n",
+  fprintf (stdout, "Copyright %s 2018-2024 Free Software Foundation, Inc.\n",
           ("(C)"));
   fnotice (stdout,
           ("This is free software; see the source for copying conditions.\n"
@@ -360,7 +360,11 @@ accept_from (char *arg ATTRIBUTE_UNUSED)
   hints.ai_next = NULL;
 
   struct addrinfo *addrs = NULL;
-  if (int e = getaddrinfo (slash == arg ? NULL : arg, "0", &hints, &addrs))
+  /* getaddrinfo requires either hostname or servname to be non-null, so that we must
+     set a port number (to cover the case that the string passed contains just /NN).
+     Use an arbitrary in-range port number, but avoiding "0" which triggers a bug on
+     some BSD variants.  */
+  if (int e = getaddrinfo (slash == arg ? NULL : arg, "1", &hints, &addrs))
     {
       noisy ("cannot resolve '%s': %s", arg, gai_strerror (e));
       ok = false;
@@ -749,8 +753,10 @@ server (bool ipv6, int sock_fd, module_resolver *resolver)
                      }
                  }
 
+#if defined (HAVE_PSELECT) || defined (HAVE_SELECT)
              if (active < 0 && sock_fd >= 0 && FD_ISSET (sock_fd, &readers))
                active = -1;
+#endif
            }
 
          if (active >= 0)