X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Fpipecmd%2Fpipecmd.c;fp=ccan%2Fpipecmd%2Fpipecmd.c;h=56cb67b615f7ed4f9f7941d82a00bc708357ef50;hp=afeaf5a0a256de9839b39b522f0cc1e3e8f142a9;hb=c16c021735d53348b6f5fe119e35feea85e6638e;hpb=9fdfa56eff5a90cd6f6052b5940b947bc3a704b4 diff --git a/ccan/pipecmd/pipecmd.c b/ccan/pipecmd/pipecmd.c index afeaf5a0..56cb67b6 100644 --- a/ccan/pipecmd/pipecmd.c +++ b/ccan/pipecmd/pipecmd.c @@ -115,7 +115,8 @@ pid_t pipecmdarr(int *fd_tochild, int *fd_fromchild, int *fd_errfromchild, goto fail; if (childpid == 0) { - for (int i = 0; i < num_child_close; i++) + int i; + for (i = 0; i < num_child_close; i++) close(child_close[i]); // Child runs command. @@ -140,7 +141,7 @@ pid_t pipecmdarr(int *fd_tochild, int *fd_fromchild, int *fd_errfromchild, /* Make (fairly!) sure all other fds are closed. */ int max = sysconf(_SC_OPEN_MAX); - for (int i = 3; i < max; i++) + for (i = 3; i < max; i++) if (i != execfail[1]) close(i); @@ -155,7 +156,8 @@ pid_t pipecmdarr(int *fd_tochild, int *fd_fromchild, int *fd_errfromchild, exit(127); } - for (int i = 0; i < num_par_close; i++) + int i; + for (i = 0; i < num_par_close; i++) close(par_close[i]); /* Child will close this without writing on successful exec. */ @@ -175,7 +177,7 @@ pid_t pipecmdarr(int *fd_tochild, int *fd_fromchild, int *fd_errfromchild, return childpid; fail: - for (int i = 0; i < num_par_close; i++) + for (i = 0; i < num_par_close; i++) close_noerr(par_close[i]); return -1; }