Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F102642769
D38367.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
932 B
Referenced Files
None
Subscribers
None
D38367.diff
View Options
diff --git a/share/man/man4/filemon.4 b/share/man/man4/filemon.4
--- a/share/man/man4/filemon.4
+++ b/share/man/man4/filemon.4
@@ -31,7 +31,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd February 1, 2022
+.Dd August 1, 2023
.Dt FILEMON 4
.Os
.Sh NAME
@@ -193,12 +193,13 @@
#include <dev/filemon/filemon.h>
#include <fcntl.h>
#include <err.h>
+#include <errno.h>
#include <unistd.h>
static void
open_filemon(void)
{
- pid_t child;
+ pid_t child, wait_rv;
int fm_fd, fm_log;
if ((fm_fd = open("/dev/filemon", O_RDWR | O_CLOEXEC)) == -1)
@@ -215,8 +216,14 @@
if (ioctl(fm_fd, FILEMON_SET_PID, &child) == -1)
err(1, "Cannot set filemon PID");
/* Do something here. */
- } else {
- wait(&child);
+ } else if (child == -1)
+ err(1, "Cannot fork child");
+ else {
+ while ((wait_rv = wait(&child)) == -1 &&
+ errno == EINTR)
+ ;
+ if (wait_rv == -1)
+ err(1, "cannot wait for child");
close(fm_fd);
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 16, 6:04 AM (21 h, 42 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14654194
Default Alt Text
D38367.diff (932 B)
Attached To
Mode
D38367: Better error checking in code example.
Attached
Detach File
Event Timeline
Log In to Comment