- int rc, len, buf_len;
- int pipefds[2], status;
- char *buf;
- pid_t pid;
-
- rc = pipe(pipefds);
- if (rc) {
- perror("pipe");
- return -1;
- }
-
- pid = fork();
-
- if (pid < 0) {
- perror("fork");
- return -1;
- }
-
- if (pid == 0) {
- close(STDIN_FILENO);
- close(pipefds[0]);
- dup2(pipefds[1], STDOUT_FILENO);
- execlp("nvram", "nvram", "--print-config",
- "--partition", partition, NULL);
- exit(EXIT_FAILURE);
- }
-
- close(pipefds[1]);