aboutsummaryrefslogtreecommitdiff
path: root/networking/ifupdown.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-02-16 13:20:56 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-02-16 13:20:56 +0000
commit3718832a1542f7bf786a1678741b8566ad3a35c6 (patch)
treeac5851de53237fb3a0c77c9cead27acd279897f0 /networking/ifupdown.c
parent1e18f1bab3400246129756a35bb5752ba98f4c90 (diff)
downloadbusybox-w32-3718832a1542f7bf786a1678741b8566ad3a35c6.tar.gz
busybox-w32-3718832a1542f7bf786a1678741b8566ad3a35c6.tar.bz2
busybox-w32-3718832a1542f7bf786a1678741b8566ad3a35c6.zip
*: more readable handling of pipe fds. No code changes.
Diffstat (limited to 'networking/ifupdown.c')
-rw-r--r--networking/ifupdown.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/networking/ifupdown.c b/networking/ifupdown.c
index d0d7bfe5b..58e69530c 100644
--- a/networking/ifupdown.c
+++ b/networking/ifupdown.c
@@ -987,11 +987,11 @@ static int iface_down(struct interface_defn_t *iface)
987static int popen2(FILE **in, FILE **out, char *command, char *param) 987static int popen2(FILE **in, FILE **out, char *command, char *param)
988{ 988{
989 char *argv[3] = { command, param, NULL }; 989 char *argv[3] = { command, param, NULL };
990 int infd[2], outfd[2]; 990 struct fd_pair infd, outfd;
991 pid_t pid; 991 pid_t pid;
992 992
993 xpipe(infd); 993 xpiped_pair(infd);
994 xpipe(outfd); 994 xpiped_pair(outfd);
995 995
996 fflush(NULL); 996 fflush(NULL);
997 pid = fork(); 997 pid = fork();
@@ -1001,18 +1001,18 @@ static int popen2(FILE **in, FILE **out, char *command, char *param)
1001 bb_perror_msg_and_die("fork"); 1001 bb_perror_msg_and_die("fork");
1002 case 0: /* child */ 1002 case 0: /* child */
1003 /* NB: close _first_, then move fds! */ 1003 /* NB: close _first_, then move fds! */
1004 close(infd[1]); 1004 close(infd.wr);
1005 close(outfd[0]); 1005 close(outfd.rd);
1006 xmove_fd(infd[0], 0); 1006 xmove_fd(infd.rd, 0);
1007 xmove_fd(outfd[1], 1); 1007 xmove_fd(outfd.wr, 1);
1008 BB_EXECVP(command, argv); 1008 BB_EXECVP(command, argv);
1009 _exit(127); 1009 _exit(127);
1010 } 1010 }
1011 /* parent */ 1011 /* parent */
1012 close(infd[0]); 1012 close(infd.rd);
1013 close(outfd[1]); 1013 close(outfd.wr);
1014 *in = fdopen(infd[1], "w"); 1014 *in = fdopen(infd.wr, "w");
1015 *out = fdopen(outfd[0], "r"); 1015 *out = fdopen(outfd.rd, "r");
1016 return pid; 1016 return pid;
1017} 1017}
1018 1018