* SUCH DAMAGE.
*/
+#include <sys/param.h>
#include <sys/time.h>
#include <errno.h>
#include <fcntl.h>
+#ifdef BSD
+# include <paths.h>
+#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* OK, this should be in dhcpcd.c
* It's here to make dhcpcd more readable */
-#ifndef HAVE_SRANDOMDEV
+#if HAVE_SRANDOMDEV
+#else
void srandomdev(void)
{
int fd;
#endif
/* strlcpy is nice, shame glibc does not define it */
-#ifndef HAVE_STRLCPY
+#if HAVE_STRLCPY
+#else
size_t
strlcpy(char *dst, const char *src, size_t size)
{
}
#endif
-#ifndef HAVE_CLOSEFROM
+#if HAVE_CLOSEFROM
+#else
int
closefrom(int fd)
{
{
int fd;
- if ((fd = open("/dev/null", O_RDWR)) == -1)
+ if ((fd = open(_PATH_DEVNULL, O_RDWR)) == -1)
return -1;
dup2(fd, fileno(stdin));
# define _unused
#endif
-#define HAVE_STRLCPY
+#ifndef HAVE_STRLCPY
+# define HAVE_STRLCPY 1
+#endif
/* Only GLIBC doesn't support strlcpy */
#ifdef __GLIBC__
-# if ! defined(__UCLIBC__) && ! defined (__dietlibc__)
+# if !defined(__UCLIBC__) && !defined (__dietlibc__)
# undef HAVE_STRLCPY
size_t strlcpy(char *, const char *, size_t);
# endif
#endif
-#define HAVE_SRANDOMDEV
+#ifndef HAVE_SRANDOMDEV
+# define HAVE_SRANDOMDEV 1
+#endif
#if defined(__GLIBC__) || defined(__NetBSD__)
# undef HAVE_SRANDOMDEV
void srandomdev(void);
#endif
-#define HAVE_CLOSEFROM
+#ifndef HAVE_CLOSEFROM
+#define HAVE_CLOSEFROM 1
+#endif
#if defined(__linux__) || defined(__FreeBSD__)
# undef HAVE_CLOSEFROM
int closefrom(int);