From 45c6b704f90cb02bb2903dd984db59d2fc2240b0 Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Wed, 19 Apr 2023 11:30:38 +0200 Subject: [PATCH] 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 --- src/net/src/main.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/net/src/main.c b/src/net/src/main.c index 716f8dc8..ffce77e6 100644 --- a/src/net/src/main.c +++ b/src/net/src/main.c @@ -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; }