[patch][doc] Fix EXAMPLE in kqueue(2)
The error control was not properly implemented. "changelist" is const, hence
event.flags is never changed by the syscall.
PR: 196844
Reported by: eugen@
Reviewed by: PauAmma <pauamma@gundo.com>
Approved by: eugen@
Fixes: 8c231786f0
This commit is contained in:
parent
f8058d3333
commit
e07b0c12ba
@ -24,7 +24,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd January 20, 2022
|
||||
.Dd April 13, 2022
|
||||
.Dt KQUEUE 2
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -742,8 +742,6 @@ main(int argc, char **argv)
|
||||
ret = kevent(kq, &event, 1, NULL, 0, NULL);
|
||||
if (ret == -1)
|
||||
err(EXIT_FAILURE, "kevent register");
|
||||
if (event.flags & EV_ERROR)
|
||||
errx(EXIT_FAILURE, "Event error: %s", strerror(event.data));
|
||||
|
||||
for (;;) {
|
||||
/* Sleep until something happens. */
|
||||
@ -751,8 +749,12 @@ main(int argc, char **argv)
|
||||
if (ret == -1) {
|
||||
err(EXIT_FAILURE, "kevent wait");
|
||||
} else if (ret > 0) {
|
||||
printf("Something was written in '%s'\en", argv[1]);
|
||||
}
|
||||
if (tevent.flags & EV_ERROR)
|
||||
errx(EXIT_FAILURE, "Event error: %s", strerror(event.data));
|
||||
else
|
||||
printf("Something was written in '%s'\en", argv[1]);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
.Ed
|
||||
|
Loading…
Reference in New Issue
Block a user