Skip some files in env-update like portage env-update for more robustness

This commit is contained in:
Roy Marples 2007-07-19 21:44:55 +00:00
parent 26d11b33cf
commit 76f2391ece
2 changed files with 11 additions and 1 deletions

View File

@ -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);

View File

@ -331,6 +331,7 @@ char **rc_get_config (char **list, const char *file)
/* Get entry */
token = strsep (&p, "=");
if (! token)
continue;