From b212babc8772413a50f09e46b6bdc1809d7568f1 Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Fri, 17 May 2013 15:10:41 +0200 Subject: [PATCH] helpers.c: Fix run() argparser, assumed all commands have args. --- helpers.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/helpers.c b/helpers.c index cc1024ac..3c4e3b53 100644 --- a/helpers.c +++ b/helpers.c @@ -368,7 +368,7 @@ int run(char *cmd) /* Split command line into tokens of an argv[] array. */ args[i++] = strsep(&arg, "\t "); - do { + while (arg && i < NUM_ARGS) { /* Handle run("su -c \"dbus-daemon --system\" messagebus"); * => "su", "-c", "\"dbus-daemon --system\"", "messagebus" */ if (*arg == '\'' || *arg == '"') { @@ -383,7 +383,7 @@ int run(char *cmd) } else { args[i++] = strsep(&arg, "\t "); } - } while (arg && i < NUM_ARGS); + } args[i] = NULL; #if 0 _e("Splitting: '%s' =>", cmd);