From ce165646dedd57f5ab098e172942eb70bb87bdf1 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Tue, 25 Oct 2016 13:57:42 -0500 Subject: [PATCH] fragment: skip empty tokens (closes #99) Due to the way that tokens are merged together for arguments which require explicit whitespace, an empty token could result in a fragment like: {.type = 'I', .data = '/usr/include '} Such a fragment would be treated differently than: {.type = 'I', .data = '/usr/include'} This difference causes the compiler to include a system include path as part of the additional includes, thus breaking things like include path shadowing, resulting in random build failures. As such, we skip empty tokens from the tokenizer as they do not have any relevance anyway. --- libpkgconf/fragment.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libpkgconf/fragment.c b/libpkgconf/fragment.c index 032b006..e596a10 100644 --- a/libpkgconf/fragment.c +++ b/libpkgconf/fragment.c @@ -105,6 +105,9 @@ pkgconf_fragment_add(pkgconf_list_t *list, const char *string, unsigned int flag { pkgconf_fragment_t *frag; + if (*string == '\0') + return; + if (!pkgconf_fragment_is_special(string)) { frag = calloc(sizeof(pkgconf_fragment_t), 1);