From: Roy Marples Date: Wed, 9 Jan 2008 10:02:28 +0000 (+0000) Subject: common.h now defines a simple define to create the function in common.c. NetBSD needs... X-Git-Tag: v3.2.3~103 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=890fe1c5a47f270316fef8b419d8aac587e5cf92;p=thirdparty%2Fdhcpcd.git common.h now defines a simple define to create the function in common.c. NetBSD needs srandomdev also. --- diff --git a/common.c b/common.c index 78f9694d..e07b26f0 100644 --- a/common.c +++ b/common.c @@ -71,7 +71,7 @@ char *getline (FILE *fp) /* OK, this should be in dhcpcd.c * It's here to make dhcpcd more readable */ -#ifdef __linux__ +#ifndef HAVE_SRANDOMDEV void srandomdev (void) { int fd; @@ -91,8 +91,7 @@ void srandomdev (void) #endif /* strlcpy is nice, shame glibc does not define it */ -#ifdef __GLIBC__ -# if ! defined (__UCLIBC__) && ! defined (__dietlibc__) +#ifndef HAVE_STRLCPY size_t strlcpy (char *dst, const char *src, size_t size) { const char *s = src; @@ -112,7 +111,6 @@ size_t strlcpy (char *dst, const char *src, size_t size) return (src - s - 1); } -# endif #endif /* Close our fd's */ diff --git a/common.h b/common.h index b28b6546..ff97e035 100644 --- a/common.h +++ b/common.h @@ -33,14 +33,18 @@ #include #include +#define HAVE_STRLCPY /* Only GLIBC doesn't support strlcpy */ #ifdef __GLIBC__ # if ! defined(__UCLIBC__) && ! defined (__dietlibc__) +# undef HAVE_STRLCPY size_t strlcpy (char *dst, const char *src, size_t size); # endif #endif -#ifdef __linux__ +#define HAVE_SRANDOMDEV +#if defined(__linux__) || defined(__NetBSD__) +# undef HAVE_SRANDOMDEV void srandomdev (void); #endif