diff options
author | Arfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org> | 2009-12-30 20:32:18 +0000 |
---|---|---|
committer | Arfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org> | 2009-12-30 20:32:18 +0000 |
commit | 96e5ae2f7f22e8af1f0428b537ba885601e02bdf (patch) | |
tree | 914a391516b7987d0f685b371277d147c4aa1211 | |
parent | Support `eselect python show --ABI`. (diff) | |
download | eselect-python-96e5ae2f7f22e8af1f0428b537ba885601e02bdf.tar.gz eselect-python-96e5ae2f7f22e8af1f0428b537ba885601e02bdf.tar.bz2 eselect-python-96e5ae2f7f22e8af1f0428b537ba885601e02bdf.zip |
EPYTHON variable shouldn't contain any '/' characters.
Don't dereference potentially null pointer.
Delete no longer needed code.
-rw-r--r-- | python-wrapper.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/python-wrapper.c b/python-wrapper.c index 7be15fc..e472c9b 100644 --- a/python-wrapper.c +++ b/python-wrapper.c @@ -16,8 +16,6 @@ /* 127 is the standard return code for "command not found" */ #define EXIT_ERROR 127 -const char program_description[] = "Gentoo Python wrapper program"; - char* dir_cat(const char* dir, const char* file) { size_t dir_len = strlen(dir); @@ -156,7 +154,7 @@ const char* find_latest(const char* exe) { return NULL; } - /* walk backwards through the list */ + /* Walk backwards through the list. */ while (n--) { if (! ret) @@ -169,9 +167,6 @@ const char* find_latest(const char* exe) int main(__attribute__((unused)) int argc, char** argv) { - if (strlen(program_description) == 0) - abort(); - const char* EPYTHON = getenv("EPYTHON"); if (! valid_interpreter(EPYTHON)) { @@ -199,13 +194,12 @@ int main(__attribute__((unused)) int argc, char** argv) if (strchr(EPYTHON, '/')) { - argv[0] = (char*) EPYTHON; - execv(EPYTHON, argv); + fprintf(stderr, "Invalid value of EPYTHON variable or invalid configuration of Python wrapper\n"); return EXIT_ERROR; } const char* path = find_path(argv[0]); - if (*path) + if (path) { argv[0] = dir_cat(path, EPYTHON); execv(argv[0], argv); |