--- dpkg-1.18.10/lib/dpkg/command.c 2016-07-04 15:55:13.000000000 -1000 +++ dpkg-1.18.10+iPhone/lib/dpkg/command.c 2018-07-27 18:00:54.000000000 -1000 @@ -31,6 +31,8 @@ #include #include +void runcmd(struct command *cmd); + /** * Initialize a command structure. * @@ -178,8 +180,7 @@ void command_exec(struct command *cmd) { - execvp(cmd->filename, (char * const *)cmd->argv); - ohshite(_("unable to execute %s (%s)"), cmd->name, cmd->filename); + runcmd(cmd); } @@ -230,3 +231,23 @@ execlp(shell, shell, mode, cmd, NULL); ohshite(_("unable to execute %s (%s)"), name, cmd); } + +void +runcmd(struct command *cmd) +{ + int i = 0; + char cmdstring[cmd->argv_size]; + char *ptr = cmdstring; // set ptr to the start of the destination buffer + for (i=0; iargc; i++) { + const char *current_arg = cmd->argv[i]; + char c; + while ( (c = *current_arg++) ) { + // copy each character to the destination buffer until the end of the current string + *ptr++ = c; + } + *ptr++ = ' '; // or whatever joining character you want + } + *ptr = '\0'; // null terminate + command_shell(cmdstring, cmd->name); + ohshite(_("unable to execute %s (%s)"), cmd->name, cmd->filename); +}