Mercurial > hg > dhcpcd
changeset 271:5c372b376105 draft
common.h now defines a simple define to create the function in common.c. NetBSD needs srandomdev also.
| author | Roy Marples <roy@marples.name> |
|---|---|
| date | Wed, 09 Jan 2008 10:02:28 +0000 |
| parents | 69e9e2b16509 |
| children | fc66fea57edc |
| files | common.c common.h |
| diffstat | 2 files changed, 7 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/common.c Wed Jan 09 09:38:00 2008 +0000 +++ b/common.c Wed Jan 09 10:02:28 2008 +0000 @@ -71,7 +71,7 @@ /* 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 @@ #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 @@ return (src - s - 1); } -# endif #endif /* Close our fd's */
--- a/common.h Wed Jan 09 09:38:00 2008 +0000 +++ b/common.h Wed Jan 09 10:02:28 2008 +0000 @@ -33,14 +33,18 @@ #include <stdio.h> #include <string.h> +#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
