From d8bd3516a0ed9617708ad2c19cb718b29ca4168b Mon Sep 17 00:00:00 2001 From: Tomas Mlcoch Date: Tue, 29 May 2012 16:19:30 +0200 Subject: [PATCH] Fix pattern matching behaviour for --excludes param --- src/createrepo_c.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/createrepo_c.c b/src/createrepo_c.c index efd73da..fdb0515 100644 --- a/src/createrepo_c.c +++ b/src/createrepo_c.c @@ -471,9 +471,10 @@ int main(int argc, char **argv) { g_message("Directory walk started"); + size_t in_dir_len = strlen(in_dir); GStringChunk *sub_dirs_chunk = g_string_chunk_new(1024); GQueue *sub_dirs = g_queue_new(); - gchar *input_dir_stripped = g_string_chunk_insert_len(sub_dirs_chunk, in_dir, strlen(in_dir)-1); + gchar *input_dir_stripped = g_string_chunk_insert_len(sub_dirs_chunk, in_dir, in_dir_len-1); g_queue_push_head(sub_dirs, input_dir_stripped); char *dirname; @@ -513,7 +514,11 @@ int main(int argc, char **argv) { } // Check filename against exclude glob masks - if (allowed_file(filename, cmd_options)) { + const gchar *repo_relative_path = filename; + if (in_dir_len < strlen(full_path)) // This probably should be always true + repo_relative_path = full_path + in_dir_len; + + if (allowed_file(repo_relative_path, cmd_options)) { // FINALLY! Add file into pool g_debug("Adding pkg: %s", full_path); struct PoolTask *task = g_malloc(sizeof(struct PoolTask)); -- 2.7.4