/* Get address information (partial implementation).
- Copyright (C) 1997, 2001, 2002, 2004, 2005, 2006 Free Software
+ Copyright (C) 1997, 2001, 2002, 2004, 2005, 2006, 2007 Free Software
Foundation, Inc.
Contributed by Simon Josefsson <simon@josefsson.org>.
/* Get calloc. */
#include <stdlib.h>
-/* Get memcpy. */
+/* Get memcpy, strdup. */
#include <string.h>
#include <stdbool.h>
#define N_(String) String
#include "inet_ntop.h"
-#include "intprops.h"
-#include "inttostr.h"
-#include "strdup.h"
+#include "snprintf.h"
/* BeOS has AF_INET, but not PF_INET. */
#ifndef PF_INET
{
unsigned short int port
= ntohs (((const struct sockaddr_in *) sa)->sin_port);
- char buf[INT_BUFSIZE_BOUND (port)];
- char const *s = uinttostr (port, buf);
- if (strlen (s) + 1 > servicelen)
+ if (servicelen <= snprintf (service, servicelen, "%u", port))
return EAI_OVERFLOW;
- memcpy (service, s, strlen (s) + 1);
}
break;
}