--- libelwix/src/pio.c 2013/12/05 15:38:48 1.1.2.5 +++ libelwix/src/pio.c 2013/12/06 00:19:54 1.1.2.6 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: pio.c,v 1.1.2.5 2013/12/05 15:38:48 misho Exp $ +* $Id: pio.c,v 1.1.2.6 2013/12/06 00:19:54 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -88,8 +88,11 @@ e_popen(const char *command, const char *type, pid_t * (type[1] && (type[1] != 'e' || type[2]))) return (NULL); } - if ((cloexec ? pipe2(pdes, O_CLOEXEC) : pipe(pdes)) < 0) + if (socketpair(AF_UNIX, SOCK_STREAM | (cloexec ? O_CLOEXEC : 0), + 0, pdes) < 0) { + LOGERR; return (NULL); + } if (!(cur = e_malloc(sizeof(struct tagPIOPID)))) { close(pdes[0]); @@ -99,12 +102,13 @@ e_popen(const char *command, const char *type, pid_t * argv[0] = "sh"; argv[1] = "-c"; - argv[2] = (char *)command; + argv[2] = (char *) command; argv[3] = NULL; THREAD_LOCK(); switch (pid = vfork()) { case -1: /* Error. */ + LOGERR; THREAD_UNLOCK(); close(pdes[0]); close(pdes[1]);