portability: Solaris 10 does not have err.h

Use error(3) function, that has gnulib portability fixes, instead of err(3)
and warn(3) family.

Reported-by: Anton Tkachev <antont@bk.ru>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
Sami Kerola 2015-10-26 22:12:37 +00:00
parent fae20302cf
commit 535dfc4fc2
No known key found for this signature in database
GPG key ID: A9553245FDE9B739
10 changed files with 84 additions and 72 deletions

View file

@ -39,13 +39,9 @@
#include <config.h>
#include "dhcpd-pools.h"
#include "defaults.h"
#include "progname.h"
#include <arpa/inet.h>
#include <err.h>
#include <errno.h>
#include <limits.h>
#include <netinet/in.h>
#include <stdbool.h>
#include <stddef.h>
@ -53,7 +49,12 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <limits.h>
#include "error.h"
#include "progname.h"
#include "dhcpd-pools.h"
#include "defaults.h"
/*! \brief Set function pointers depending on IP version.
* \param ip IP version.
@ -378,9 +379,7 @@ double strtod_or_err(const char *restrict str, const char *restrict errmesg)
goto err;
return num;
err:
if (errno)
err(EXIT_FAILURE, "%s: '%s'", errmesg, str);
errx(EXIT_FAILURE, "%s: '%s'", errmesg, str);
error(EXIT_FAILURE, errno, "%s: '%s'", errmesg, str);
}
/*! \brief Reverse range.
@ -404,7 +403,7 @@ void clean_up(void)
{
/* Just in case there something in buffers */
if (fflush(NULL))
warn("clean_up: fflush");
error(0, 0, "clean_up: fflush");
free(config.dhcpdconf_file);
free(config.dhcpdlease_file);
free(config.output_file);