src/net: must close each pipe before exectuing the next pipe action

For instance, when adding ip command to the ip pipe we need the kernel
to execute those commands before the bridge command pipe is executed.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2023-04-20 21:14:54 +02:00
committed by Tobias Waldekranz
parent 2de8ff052d
commit 45c6b704f9
+9 -2
View File
@@ -223,12 +223,13 @@ static int iter(char *path, size_t len, const char *action)
{
char **files;
int rc = 0;
FILE *pp;
int num;
num = dir(path, NULL, dir_filter, &files, 0);
for (int j = 0; j < num; j++) {
char *ifname = files[j];
for (int i = 0; i < num; i++) {
char *ifname = files[i];
char ipath[len];
snprintf(ipath, sizeof(ipath), "%s/%s", path, ifname);
@@ -240,6 +241,12 @@ static int iter(char *path, size_t len, const char *action)
freeifs();
pp = pipep(action);
if (pp) {
log("closing pipe for %s", action);
pclose(pp);
}
return rc;
}