diff options
author | Jeremy Katz <katzj@redhat.com> | 2003-01-07 23:13:49 +0000 |
---|---|---|
committer | Jeremy Katz <katzj@redhat.com> | 2003-01-07 23:13:49 +0000 |
commit | 61bf7b98c090e3332e9fb469f07ca4c5bf4ca184 (patch) | |
tree | 5e751befbc71ed119c0a91753f91a405fc173f8e /loader/popen.c | |
parent | 7a580c898db8aad8e8619d562b453436df47cb7e (diff) | |
download | anaconda-61bf7b98c090e3332e9fb469f07ca4c5bf4ca184.tar.gz anaconda-61bf7b98c090e3332e9fb469f07ca4c5bf4ca184.tar.xz anaconda-61bf7b98c090e3332e9fb469f07ca4c5bf4ca184.zip |
remove old loader dir. for referencing, go back to anaconda-8-0-branch
Diffstat (limited to 'loader/popen.c')
-rw-r--r-- | loader/popen.c | 74 |
1 files changed, 0 insertions, 74 deletions
diff --git a/loader/popen.c b/loader/popen.c deleted file mode 100644 index 75a15031f..000000000 --- a/loader/popen.c +++ /dev/null @@ -1,74 +0,0 @@ -#include <errno.h> -#include <fcntl.h> -#include <popt.h> -#include <string.h> -#include <sys/wait.h> -#include <unistd.h> -#include <stdlib.h> - -#include <syslog.h> - -struct req { - FILE * f; - pid_t child; -}; - -struct req lastRequest = { NULL, -1 }; - -FILE * popen(const char * command, const char * type) { - char ** argv; - int argc; - int p[2]; - pid_t child; - - if (strcmp(type, "r") || lastRequest.f) - return NULL; - - if (poptParseArgvString(command, &argc, (const char ***) &argv)) { - return NULL; - } - - pipe(p); - - if (!(child = fork())) { - int i; - char ** args; - - close(p[0]); - dup2(p[1], 1); - dup2(p[1], 2); - close(p[1]); - - args = malloc(sizeof(*args) * (argc + 1)); - for (i = 0; i < argc; i++) { - args[i] = argv[i]; - } - - args[argc] = NULL; - - execv("/sbin/insmod", args); - exit(1); - } - - free(argv); - - close(p[1]); - - lastRequest.f = fdopen(p[0], "r"); - lastRequest.child = child; - - return lastRequest.f; -} - -int pclose(FILE * stream) { - int status; - - if (stream != lastRequest.f) return -1; - - fclose(stream); - - waitpid(lastRequest.child, &status, 0); - lastRequest.f = NULL; - - return status; -} |