Skip to contentSkip to conversation

app/test: quieten noise while forking

PATCH In review John Levon 2 participants 4 messages Jul 26, 2021 – Aug 2, 2021

lore
Share & tools
lore

John Levon

author
#0 lore raw

PATCH 1/1 app/test: quieten noise while forking

When closing file descriptors post-fork, ignore "." and ".." directory entries.

---
 app/test/process.h | 5 +++++
 1 file changed, 5 insertions(+)
app/test/process.h +5 -0
index 0ed91a939e..5b10cf64df 100644
@@ -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') {
Signature · 1 line
2.25.1
#1 lore raw

26/07/2021 14:17, John Levon:

Quoted 4 lines

When closing file descriptors post-fork, ignore "." and ".." directory entries.

Please could you add an example of the noise in the commit explanation? Thanks

author
#2 lore raw

PATCH 1/1 app/test: quieten noise while forking

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 ..:

---
 app/test/process.h | 5 +++++
 1 file changed, 5 insertions(+)
app/test/process.h +5 -0
index 0ed91a939e..5b10cf64df 100644
@@ -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') {
Signature · 1 line
2.25.1
#3 lore raw

01/08/2021 19:53, John Levon:

Quoted 7 lines

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 ..:

Applied, thanks.

For info, when sending a new version (in future), please add a number with the option -v (-v2 in this case).