app/test: quieten noise while forking
Checks
Commit Message
When closing file descriptors post-fork, ignore "." and ".."
directory entries.
Signed-off-by: John Levon <john.levon@nutanix.com>
---
app/test/process.h | 5 +++++
1 file changed, 5 insertions(+)
Comments
26/07/2021 14:17, John Levon:
> When closing file descriptors post-fork, ignore "." and ".."
> directory entries.
>
> Signed-off-by: John Levon <john.levon@nutanix.com>
Please could you add an example of the noise in the commit explanation?
Thanks
@@ -90,6 +90,11 @@ process_dup(const char *const argv[], int numargs, const char *env_value)
}
while ((dirent = readdir(dir)) != NULL) {
+
+ if (strcmp(dirent->d_name, ".") == 0 ||
+ strcmp(dirent->d_name, "..") == 0)
+ continue;
+
errno = 0;
fd = strtol(dirent->d_name, &endptr, 10);
if (errno != 0 || endptr[0] != '\0') {