summaryrefslogtreecommitdiff
path: root/libudev
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2009-09-07 12:12:55 +0200
committerKay Sievers <kay.sievers@vrfy.org>2009-09-07 12:13:50 +0200
commitf55083ce34c4065a4c87c98e0c77cb4bf70909d0 (patch)
treebb430cd55ed410b143d5f8ced9a7ec65174a5ea7 /libudev
parentd412a685736e3b3350b555f4d7d8ebfc80aa54c9 (diff)
util_run_program(): skip multiple spaces in argv creation
Diffstat (limited to 'libudev')
-rw-r--r--libudev/libudev-util-private.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/libudev/libudev-util-private.c b/libudev/libudev-util-private.c
index dfde5a998d..fb64c13229 100644
--- a/libudev/libudev-util-private.c
+++ b/libudev/libudev-util-private.c
@@ -269,10 +269,14 @@ int util_run_program(struct udev *udev, const char *command, char **envp,
/* do not separate quotes */
pos++;
argv[i] = strsep(&pos, "\'");
- while (pos != NULL && pos[0] == ' ')
- pos++;
+ if (pos != NULL)
+ while (pos[0] == ' ')
+ pos++;
} else {
argv[i] = strsep(&pos, " ");
+ if (pos != NULL)
+ while (pos[0] == ' ')
+ pos++;
}
dbg(udev, "arg[%i] '%s'\n", i, argv[i]);
i++;