commit:     cd7c5018d4bffa34bd5aab6848525fd83d392de7
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sun Apr  1 10:20:12 2018 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sun Apr  1 10:20:12 2018 +0000
URL:        https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=cd7c5018

read_portage_env_file: properly ignore backup files

backup files are suffixed by '~', not prefixed

 main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/main.c b/main.c
index 85740b8..023b42e 100644
--- a/main.c
+++ b/main.c
@@ -670,7 +670,8 @@ read_portage_env_file(const char *configroot, const char 
*file, env_vars vars[])
                /* recurse through all files */
                for (di = 0; di < dentslen; di++) {
                        d = dents[di];
-                       if (d->d_name[0] == '.' || d->d_name[0] == '~')
+                       if (d->d_name[0] == '.' || d->d_name[0] == '\0' ||
+                                       d->d_name[strlen(d->d_name) - 1] == '~')
                                continue;
                        snprintf(npath, sizeof(npath), "%s/%s", file, 
d->d_name);
                        read_portage_env_file(configroot, npath, vars);

Reply via email to