Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- two = fork();
- switch (two) {
- case -1 :
- perror("Cannot fork.");
- exit(1);
- case 0 :
- close(p0[WRITE]);
- dup2(p0[READ], STDIN_FILENO);
- close(p0[READ]);
- dup2(s0, STDOUT_FILENO);
- dup2(s0, STDERR_FILENO); /* duplicate socket on stderr too */
- execlp("/bin/sh", "sh", "-c", "grep rwxr-xr-x", NULL);
- perror("execl");
- exit(1);
- }
- three = fork();
- switch (three) {
- case -1 :
- perror("Cannot fork.");
- exit(1);
- case 0 :
- dup2(s0, STDIN_FILENO);
- dup2(s0, STDOUT_FILENO);
- dup2(s0, STDERR_FILENO); /* duplicate socket on stderr too */
- execlp("/bin/sh", "sh", "-c", "cat", NULL);
- perror("execl");
- exit(1);
- }
Add Comment
Please, Sign In to add comment