summaryrefslogtreecommitdiffstats
path: root/contrib/ntp/libntp/socktoa.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/ntp/libntp/socktoa.c')
-rw-r--r--contrib/ntp/libntp/socktoa.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/contrib/ntp/libntp/socktoa.c b/contrib/ntp/libntp/socktoa.c
index 34de784..fb41b22 100644
--- a/contrib/ntp/libntp/socktoa.c
+++ b/contrib/ntp/libntp/socktoa.c
@@ -6,7 +6,6 @@
#include <sys/types.h>
#include <sys/socket.h>
-#include <netdb.h>
#include <netinet/in.h>
#include <arpa/inet.h>
@@ -31,10 +30,14 @@ socktoa(
LIB_GETBUF(buffer);
- if (sock == NULL) printf("null");
+ if (sock == NULL)
+ strcpy(buffer, "null");
+ else
+ {
- switch(sock->ss_family) {
+ switch(sock->ss_family) {
+ default:
case AF_INET :
inet_ntop(AF_INET, &GET_INADDR(*sock), buffer,
LIB_BUFLENGTH);
@@ -43,6 +46,11 @@ socktoa(
case AF_INET6 :
inet_ntop(AF_INET6, &GET_INADDR6(*sock), buffer,
LIB_BUFLENGTH);
+#if 0
+ default:
+ strcpy(buffer, "unknown");
+#endif
+ }
}
return buffer;
}
OpenPOWER on IntegriCloud