mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-11-01 00:51:08 +03:00
run_program: prevent empty last argv entry
This commit is contained in:
parent
be7f7f5701
commit
c28c4486af
@ -138,9 +138,9 @@ static int run_program(struct udev_device *dev, const char *command,
|
|||||||
if (strchr(arg, ' ') != NULL) {
|
if (strchr(arg, ' ') != NULL) {
|
||||||
char *pos = arg;
|
char *pos = arg;
|
||||||
|
|
||||||
while (pos != NULL) {
|
while (pos != NULL && pos[0] != '\0') {
|
||||||
if (pos[0] == '\'') {
|
if (pos[0] == '\'') {
|
||||||
/* don't separate if in apostrophes */
|
/* do not separate quotes */
|
||||||
pos++;
|
pos++;
|
||||||
argv[i] = strsep(&pos, "\'");
|
argv[i] = strsep(&pos, "\'");
|
||||||
while (pos != NULL && pos[0] == ' ')
|
while (pos != NULL && pos[0] == ' ')
|
||||||
|
Loading…
Reference in New Issue
Block a user