test: quieten warning noise while forking
authorJohn Levon <john.levon@nutanix.com>
Sun, 1 Aug 2021 17:53:25 +0000 (18:53 +0100)
committerThomas Monjalon <thomas@monjalon.net>
Mon, 2 Aug 2021 11:21:02 +0000 (13:21 +0200)
When closing file descriptors post-fork, ignore "." and ".." directory
entries, so the test log doesn't have distracting errors like:

Error converting name fd 0 .:
Error converting name fd 0 ..:

Signed-off-by: John Levon <john.levon@nutanix.com>
app/test/process.h

index 0ed91a9..5b10cf6 100644 (file)
@@ -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') {