app/test: quieten noise while forking

Message ID 20210726121708.2324809-1-john.levon@nutanix.com (mailing list archive)
State Superseded, archived
Delegated to: David Marchand
Headers
Series app/test: quieten noise while forking |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/github-robot success github build: passed
ci/iol-intel-Functional success Functional Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-intel-Performance success Performance Testing PASS
ci/intel-Testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS

Commit Message

John Levon July 26, 2021, 12:17 p.m. UTC
  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

Thomas Monjalon July 31, 2021, 5:48 p.m. UTC | #1
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
  

Patch

diff --git a/app/test/process.h b/app/test/process.h
index 0ed91a939e..5b10cf64df 100644
--- a/app/test/process.h
+++ b/app/test/process.h
@@ -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') {