commit:     4977ffabe0b76de0c2618a6cab36ae0fdfcf83f9
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 10 18:38:02 2019 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Mon Jun 10 18:38:02 2019 +0000
URL:        https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=4977ffab

main: fix makeargv behaviour on empty input

Found on Ubuntu where obviously no Portage config exists, this made
qmerge test fail because paths were incorrectly never seen as protected.

Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 main.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/main.c b/main.c
index 56a05d3..1f51542 100644
--- a/main.c
+++ b/main.c
@@ -194,6 +194,12 @@ makeargv(const char *string, int *argc, char ***argv)
        q = xstrdup(string);
        str = q;
 
+       /* shortcut empty strings */
+       while (isspace((int)*string))
+               string++;
+       if (*string == '\0')
+               return;
+
        remove_extra_space(str);
        rmspace(str);
 

Reply via email to