Clarify the meaning of a test.

Rather than using err() if either of two failure conditions
fires (which can produce spurious error messages), just use
errx() if the one condition that really matters fires.

In practice, this single test is enough to detect the failure
mode we're looking for (kqueue being inherited across fork).

Approved by: mentor (rwatson), re (Capsicum blanket)
Sponsored by: Google Inc
This commit is contained in:
Jonathan Anderson 2011-07-08 12:16:30 +00:00
parent 49901133a1
commit 345f2b96e2
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=223865
2 changed files with 4 additions and 4 deletions

View File

@ -1,4 +1,4 @@
# $FreeBSD$ /* $FreeBSD$ */
#define HAVE_ERR_H 1 #define HAVE_ERR_H 1
#define HAVE_SYS_EVENT_H 1 #define HAVE_SYS_EVENT_H 1

View File

@ -43,9 +43,9 @@ add_and_delete(void)
pid = fork(); pid = fork();
if (pid == 0) { if (pid == 0) {
struct stat s; struct stat s;
if ((fstat(kqfd, &s) != -1) || (errno != EBADF)) if (fstat(kqfd, &s) != -1)
err(1, "%s:%d - %s: fstat(kqfd) in child did not return EBADF", errx(1, "kqueue inherited across fork! (%s() at %s:%d)",
__FILE__, __LINE__, __func__); __func__, __FILE__, __LINE__);
pause(); pause();
exit(2); exit(2);