1 |
commit: 604df91aa544b65a6630b281b8a91d811c24e3f6 |
2 |
Author: Matthew White <mehw.is.me <AT> inventati <DOT> org> |
3 |
AuthorDate: Sun Jan 7 06:10:01 2018 +0000 |
4 |
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Jan 8 12:32:27 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=604df91a |
7 |
|
8 |
read_repos_conf: reject ~ postfixed files (aka backup files) |
9 |
|
10 |
* main.c (read_repos_conf): Exclude backup files (aka files with ~ as |
11 |
postfix) from processing when reading the repos_conf directory. |
12 |
|
13 |
The old behaviour was to process any file found in repos_conf (i.e. |
14 |
/etc/portage/repos.conf/*), except those beginning with '.'. This |
15 |
meant that '.', '..', and '.file' are rejected, but 'file.conf~' is |
16 |
accepted. Since 'file.conf~' is a backup file, by default it should |
17 |
rather not be processed. |
18 |
|
19 |
Bug: https://bugs.gentoo.org/643820 |
20 |
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org> |
21 |
|
22 |
main.c | 4 ++++ |
23 |
1 file changed, 4 insertions(+) |
24 |
|
25 |
diff --git a/main.c b/main.c |
26 |
index b118ab8..b11fe83 100644 |
27 |
--- a/main.c |
28 |
+++ b/main.c |
29 |
@@ -513,6 +513,10 @@ read_repos_conf(const char *configroot, const char *repos_conf) |
30 |
if (name[0] == '.') |
31 |
continue; |
32 |
|
33 |
+ /* Exclude backup files (aka files with ~ as postfix). */ |
34 |
+ if (name[0] != '\0' && name[strlen(name) - 1] == '~') |
35 |
+ continue; |
36 |
+ |
37 |
#ifdef DT_UNKNOWN |
38 |
if (confs[i]->d_type != DT_UNKNOWN && |
39 |
confs[i]->d_type != DT_REG && |