diff options
author | netblue30 <netblue30@protonmail.com> | 2023-12-22 18:22:33 -0500 |
---|---|---|
committer | netblue30 <netblue30@protonmail.com> | 2023-12-22 18:22:33 -0500 |
commit | 619e58ea75693bdf446c11aaffbfdfbb63d75f53 (patch) | |
tree | 5f8fcc71dc5ab683bf3976d8aba84d8ea6bf9288 /src | |
parent | landlock: add support for PATH macro (diff) | |
download | firejail-619e58ea75693bdf446c11aaffbfdfbb63d75f53.tar.gz firejail-619e58ea75693bdf446c11aaffbfdfbb63d75f53.tar.zst firejail-619e58ea75693bdf446c11aaffbfdfbb63d75f53.zip |
fix /usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games macro init
Diffstat (limited to 'src')
-rw-r--r-- | src/firejail/paths.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/firejail/paths.c b/src/firejail/paths.c index fea842d93..7fed7bb80 100644 --- a/src/firejail/paths.c +++ b/src/firejail/paths.c | |||
@@ -76,8 +76,12 @@ static void init_paths(void) { | |||
76 | if (bin_symlink > 0) { | 76 | if (bin_symlink > 0) { |
77 | if (strcmp(elt, "/bin") == 0 || strcmp(elt, "/usr/bin") == 0) | 77 | if (strcmp(elt, "/bin") == 0 || strcmp(elt, "/usr/bin") == 0) |
78 | bin_symlink++; | 78 | bin_symlink++; |
79 | if (bin_symlink == 3) | 79 | if (bin_symlink == 3) { |
80 | bin_symlink = 0; | ||
81 | if (arg_debug) | ||
82 | printf("...skip path %s\n", elt); | ||
80 | goto skip; | 83 | goto skip; |
84 | } | ||
81 | } | 85 | } |
82 | 86 | ||
83 | // filter out duplicate entries | 87 | // filter out duplicate entries |
@@ -85,14 +89,19 @@ static void init_paths(void) { | |||
85 | if (strcmp(elt, paths[j]) == 0) | 89 | if (strcmp(elt, paths[j]) == 0) |
86 | goto skip; | 90 | goto skip; |
87 | 91 | ||
92 | if (arg_debug) | ||
93 | printf("Add path entry %s\n", elt); | ||
88 | paths[i++] = elt; | 94 | paths[i++] = elt; |
89 | if (len > longest_path_elt) | 95 | if (len > longest_path_elt) |
90 | longest_path_elt = len; | 96 | longest_path_elt = len; |
91 | 97 | ||
92 | skip:; | 98 | skip:; |
93 | } | 99 | } |
94 | |||
95 | assert(paths[i] == NULL); | 100 | assert(paths[i] == NULL); |
101 | path_cnt = i; | ||
102 | if (arg_debug) | ||
103 | printf("Number of path entries: %d\n", path_cnt); | ||
104 | |||
96 | // path_cnt may be too big now, if entries were skipped above | 105 | // path_cnt may be too big now, if entries were skipped above |
97 | path_cnt = i+1; | 106 | path_cnt = i+1; |
98 | } | 107 | } |