aboutsummaryrefslogtreecommitdiffstats
path: root/src/fbuilder/build_fs.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fbuilder/build_fs.c')
-rw-r--r--src/fbuilder/build_fs.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/fbuilder/build_fs.c b/src/fbuilder/build_fs.c
index 5e63c241a..01104edb1 100644
--- a/src/fbuilder/build_fs.c
+++ b/src/fbuilder/build_fs.c
@@ -178,16 +178,22 @@ void build_var(const char *fname) {
178static FileDB *share_out = NULL; 178static FileDB *share_out = NULL;
179static void share_callback(char *ptr) { 179static void share_callback(char *ptr) {
180 // extract the directory: 180 // extract the directory:
181 // "/usr/share/bash-completion/bash_completion" becomes "/usr/share/bash-completion"
182 assert(strncmp(ptr, "/usr/share", 10) == 0); 181 assert(strncmp(ptr, "/usr/share", 10) == 0);
183 char *p1 = ptr + 10; 182 char *p1 = ptr + 10;
184 if (*p1 != '/') 183 if (*p1 != '/')
185 return; 184 return;
186 p1++; 185 p1++;
186 if (*p1 == '/') // double '/'
187 p1++;
188 if (*p1 == '\0')
189 return;
190
191 // "/usr/share/bash-completion/bash_completion" becomes "/usr/share/bash-completion"
187 char *p2 = strchr(p1, '/'); 192 char *p2 = strchr(p1, '/');
188 if (p2) 193 if (p2)
189 *p2 = '\0'; 194 *p2 = '\0';
190 195
196 // store the file
191 share_out = filedb_add(share_out, ptr); 197 share_out = filedb_add(share_out, ptr);
192} 198}
193 199