]> diplodocus.org Git - nmh/blobdiff - test/getfqdn.c
Sigh. Make sure the binaries aren't stripped as well.
[nmh] / test / getfqdn.c
index 23685da19a20fd4b40c9d4e403336d41cdf6182a..2fee4852052caff129d32a33735e2f8b841593bf 100644 (file)
@@ -13,6 +13,7 @@
 #include <limits.h>  /* for _POSIX_HOST_NAME_MAX */
 #include <string.h>  /* for memset */
 #include <stdio.h>
+#include <errno.h>
 
 
 int
@@ -44,7 +45,11 @@ main(int argc, char *argv[])
     if ((status = getaddrinfo(hostname, NULL, &hints, &res)) == 0) {
       printf ("%s\n", res->ai_canonname);
       freeaddrinfo(res);
+    } else {
+      printf("%s\n", hostname);
     }
+  } else {
+    fprintf(stderr, "gethostname() failed: %s\n", strerror(errno));
   }
 
   return status;