Use warnx() to issue error message.

Reported by:	cem
MFC after:	1 week
X-MFC with:	r316993, r316994
This commit is contained in:
Cy Schubert 2017-04-16 04:36:22 +00:00
parent 44c63714ce
commit c6fd01fbbb
2 changed files with 4 additions and 2 deletions

View File

@ -1,4 +1,5 @@
#include "ipf.h" #include "ipf.h"
#include <err.h>
extern int nohdrfields; extern int nohdrfields;
@ -33,7 +34,7 @@ wordtab_t *parsefields(table, arg)
} else { } else {
fields = reallocarray(fields, num + 1, sizeof(*fields)); fields = reallocarray(fields, num + 1, sizeof(*fields));
if (fields == NULL) { if (fields == NULL) {
perror("memory allocation error at __LINE__ in __FUNCTIOIN__ in __FILE__"); warnx("memory allocation error at %d in %s in %s", __LINE__, __FUNCTION__, __FILE__);
abort(); abort();
} }
} }

View File

@ -9,6 +9,7 @@
#include "ipf.h" #include "ipf.h"
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <syslog.h> #include <syslog.h>
#include <err.h>
#ifdef IPFILTER_BPF #ifdef IPFILTER_BPF
# include <pcap.h> # include <pcap.h>
#endif #endif
@ -2196,7 +2197,7 @@ char *phrase;
s = strtok(NULL, " \r\n\t"), i++) { s = strtok(NULL, " \r\n\t"), i++) {
fb = reallocarray(fb, i / 4 + 1, sizeof(*fb)); fb = reallocarray(fb, i / 4 + 1, sizeof(*fb));
if (fb == NULL) { if (fb == NULL) {
perror("memory allocation error at __LINE__ in __FUNCTION__ in __FILE"); warnx("memory allocation error at %d in %s in %s", __LINE__, __FUNCTION__, __FILE__);
abort(); abort();
} }
l = (u_32_t)strtol(s, NULL, 0); l = (u_32_t)strtol(s, NULL, 0);