]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
common.h now defines a simple define to create the function in common.c. NetBSD needs...
authorRoy Marples <roy@marples.name>
Wed, 9 Jan 2008 10:02:28 +0000 (10:02 +0000)
committerRoy Marples <roy@marples.name>
Wed, 9 Jan 2008 10:02:28 +0000 (10:02 +0000)
common.c
common.h

index 78f9694d1e32527defa36bfee2e056a8de39e3d0..e07b26f05055c0f8554303c209f7d1518e8020fd 100644 (file)
--- 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 */
index b28b6546c8ae1d8f9e8312e149d1c2e5ed2d6949..ff97e035f18f3acb6673e4de31a37aa764deb977 100644 (file)
--- a/common.h
+++ b/common.h
 #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