Imported Upstream version 4.1
[platform/upstream/make.git] / remote-cstms.c
index 8d6c635..867ee8d 100644 (file)
@@ -3,7 +3,7 @@
    Please do not send bug reports or questions about it to
    the Make maintainers.
 
-Copyright (C) 1988-2013 Free Software Foundation, Inc.
+Copyright (C) 1988-2014 Free Software Foundation, Inc.
 This file is part of GNU Make.
 
 GNU Make is free software; you can redistribute it and/or modify it under the
@@ -151,7 +151,7 @@ start_remote_job (char **argv, char **envp, int stdin_fd,
   retsock = Rpc_UdpCreate (True, 0);
   if (retsock < 0)
     {
-      error (NILF, "exporting: Couldn't create return socket.");
+      O (error, NILF, "exporting: Couldn't create return socket.");
       return 1;
     }
 
@@ -192,33 +192,35 @@ start_remote_job (char **argv, char **envp, int stdin_fd,
 
   host = gethostbyaddr ((char *)&permit.addr, sizeof(permit.addr), AF_INET);
 
-  if (status != RPC_SUCCESS)
-    {
-      (void) close (retsock);
-      (void) close (sock);
-      error (NILF, "exporting to %s: %s",
-             host ? host->h_name : inet_ntoa (permit.addr),
-             Rpc_ErrorMessage (status));
-      return 1;
-    }
-  else if (msg[0] != 'O' || msg[1] != 'k' || msg[2] != '\0')
-    {
-      (void) close (retsock);
-      (void) close (sock);
-      error (NILF, "exporting to %s: %s",
-             host ? host->h_name : inet_ntoa (permit.addr),
-             msg);
-      return 1;
-    }
-  else
-    {
-      error (NILF, "*** exported to %s (id %u)",
-              host ? host->h_name : inet_ntoa (permit.addr),
-              permit.id);
-    }
-
-  fflush (stdout);
-  fflush (stderr);
+  {
+    const char *hnm = host ? host->h_name : inet_ntoa (permit.addr);
+    size_t hlen = strlen (hnm);
+
+    if (status != RPC_SUCCESS)
+      {
+        const char *err = Rpc_ErrorMessage (status);
+        (void) close (retsock);
+        (void) close (sock);
+        error (NILF, hlen + strlen (err),
+               "exporting to %s: %s", hnm, err);
+        return 1;
+      }
+    else if (msg[0] != 'O' || msg[1] != 'k' || msg[2] != '\0')
+      {
+        (void) close (retsock);
+        (void) close (sock);
+        error (NILF, hlen + strlen (msg), "exporting to %s: %s", hnm, msg);
+        return 1;
+      }
+    else
+      {
+        error (NILF, hlen + INTSTR_LENGTH,
+               "*** exported to %s (id %u)", hnm, permit.id);
+      }
+
+    fflush (stdout);
+    fflush (stderr);
+  }
 
   pid = fork ();
   if (pid < 0)