On 03 May 2015 00:39, Gabriel Corona wrote: > +static int open_shell_command(char* command) const, and the * should be next to "command", not "char" > + res = socketpair(AF_LOCAL, SOCK_STREAM, 0, sockets); space before the "(" -- this comes up a lot in your patch > + else if (child == 0) > + { > + if (close (sockets[0]) < 0) > + exit (1); > + if (dup2 (sockets[1], 0) < 0 || dup2 (sockets[1], 1) < 0) > + exit (1); why not use error() instead of exit(1) ? shouldn't you close sockets[1] after the dup2 ? > + res = fork (); > + if (res < 0) > + exit (1); > + if (res != 0) > + exit (0); the double fork could use a comment > + { > + signal (SIGPIPE, SIG_IGN); > + while ((pid = waitpid (child, NULL, 0)) < 0 && errno == EINTR); > + if (pid < 0) > + error ("Could not wait for child."); > + close (sockets[1]); > + return sockets[0]; shouldn't this close sockets[1] before anything else ? -mike