diff options
author | Roy Marples <roy@marples.name> | 2007-07-19 21:44:55 +0000 |
---|---|---|
committer | Roy Marples <roy@marples.name> | 2007-07-19 21:44:55 +0000 |
commit | 76f2391ecea775b6d84299620bd1ac18d22b2564 (patch) | |
tree | 09f33db8a20cc2d7d1d538b14456d84350852274 | |
parent | 26d11b33cf4dc9d15688c734632ea850c6d2e3d3 (diff) |
Skip some files in env-update like portage env-update for more robustness
-rw-r--r-- | src/env-update.c | 11 | ||||
-rw-r--r-- | src/librc-misc.c | 1 |
2 files changed, 11 insertions, 1 deletions
diff --git a/src/env-update.c b/src/env-update.c index de886a33..5527070d 100644 --- a/src/env-update.c +++ b/src/env-update.c @@ -127,7 +127,16 @@ int main (int argc, char **argv) char *path = rc_strcatpaths (ENVDIR, file, (char *) NULL); char **entries = NULL; - if (! rc_is_dir (path)) + j = strlen (file); + if (! rc_is_dir (path) && + j > 2 && + *file >= '0' && + *file <= '9' && + *(file + 1) >= '0' && + *(file + 1) <= '9' && + *(file + j - 1) != '~' && + (j < 4 || strcmp (file + j - 4, ".bak") != 0) && + (j < 5 || strcmp (file + j - 5, ".core") != 0)) entries = rc_get_config (NULL, path); free (path); diff --git a/src/librc-misc.c b/src/librc-misc.c index fd1282ad..b52c2507 100644 --- a/src/librc-misc.c +++ b/src/librc-misc.c @@ -331,6 +331,7 @@ char **rc_get_config (char **list, const char *file) /* Get entry */ token = strsep (&p, "="); + if (! token) continue; |