aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew White <mehw.is.me@inventati.org>2018-01-07 07:10:01 +0100
committerFabian Groffen <grobian@gentoo.org>2018-01-08 13:32:27 +0100
commit604df91aa544b65a6630b281b8a91d811c24e3f6 (patch)
tree2e80563caa29e9efe5f0a493ac36533d31cce7ef
parentREADME: mention the configure alternative (diff)
downloadportage-utils-604df91aa544b65a6630b281b8a91d811c24e3f6.tar.gz
portage-utils-604df91aa544b65a6630b281b8a91d811c24e3f6.tar.bz2
portage-utils-604df91aa544b65a6630b281b8a91d811c24e3f6.zip
read_repos_conf: reject ~ postfixed files (aka backup files)
* main.c (read_repos_conf): Exclude backup files (aka files with ~ as postfix) from processing when reading the repos_conf directory. The old behaviour was to process any file found in repos_conf (i.e. /etc/portage/repos.conf/*), except those beginning with '.'. This meant that '.', '..', and '.file' are rejected, but 'file.conf~' is accepted. Since 'file.conf~' is a backup file, by default it should rather not be processed. Bug: https://bugs.gentoo.org/643820 Signed-off-by: Fabian Groffen <grobian@gentoo.org>
-rw-r--r--main.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/main.c b/main.c
index b118ab8..b11fe83 100644
--- a/main.c
+++ b/main.c
@@ -513,6 +513,10 @@ read_repos_conf(const char *configroot, const char *repos_conf)
if (name[0] == '.')
continue;
+ /* Exclude backup files (aka files with ~ as postfix). */
+ if (name[0] != '\0' && name[strlen(name) - 1] == '~')
+ continue;
+
#ifdef DT_UNKNOWN
if (confs[i]->d_type != DT_UNKNOWN &&
confs[i]->d_type != DT_REG &&