diff options
Diffstat (limited to 'src/fbuilder/filedb.c')
-rw-r--r-- | src/fbuilder/filedb.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/fbuilder/filedb.c b/src/fbuilder/filedb.c index 569095785..89b6980d2 100644 --- a/src/fbuilder/filedb.c +++ b/src/fbuilder/filedb.c | |||
@@ -25,17 +25,17 @@ FileDB *filedb_find(FileDB *head, const char *fname) { | |||
25 | assert(fname); | 25 | assert(fname); |
26 | FileDB *ptr = head; | 26 | FileDB *ptr = head; |
27 | int found = 0; | 27 | int found = 0; |
28 | int len = strlen(fname); | ||
29 | 28 | ||
30 | while (ptr) { | 29 | while (ptr) { |
31 | // exact name | 30 | // ptr->fname can be a pattern, like .mutter-Xwaylandauth.* |
32 | if (strcmp(fname, ptr->fname) == 0) { | 31 | // check if fname is a match |
32 | if (fnmatch(ptr->fname, fname, FNM_PATHNAME) == 0) { | ||
33 | found = 1; | 33 | found = 1; |
34 | break; | 34 | break; |
35 | } | 35 | } |
36 | 36 | ||
37 | // parent directory in the list | 37 | // parent directory in the list |
38 | if (len > ptr->len && | 38 | if (strlen(fname) > ptr->len && |
39 | fname[ptr->len] == '/' && | 39 | fname[ptr->len] == '/' && |
40 | strncmp(ptr->fname, fname, ptr->len) == 0) { | 40 | strncmp(ptr->fname, fname, ptr->len) == 0) { |
41 | found = 1; | 41 | found = 1; |
@@ -54,8 +54,6 @@ FileDB *filedb_find(FileDB *head, const char *fname) { | |||
54 | FileDB *filedb_add(FileDB *head, const char *fname) { | 54 | FileDB *filedb_add(FileDB *head, const char *fname) { |
55 | assert(fname); | 55 | assert(fname); |
56 | 56 | ||
57 | // todo: support fnames such as ${RUNUSER}/.mutter-Xwaylandauth.* | ||
58 | |||
59 | // don't add it if it is already there or if the parent directory is already in the list | 57 | // don't add it if it is already there or if the parent directory is already in the list |
60 | if (filedb_find(head, fname)) | 58 | if (filedb_find(head, fname)) |
61 | return head; | 59 | return head; |