summaryrefslogtreecommitdiff
path: root/data/dpkg/runcmd.diff
diff options
context:
space:
mode:
Diffstat (limited to 'data/dpkg/runcmd.diff')
-rw-r--r--data/dpkg/runcmd.diff45
1 files changed, 45 insertions, 0 deletions
diff --git a/data/dpkg/runcmd.diff b/data/dpkg/runcmd.diff
new file mode 100644
index 000000000..80edf7ee6
--- /dev/null
+++ b/data/dpkg/runcmd.diff
@@ -0,0 +1,45 @@
+--- 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 <dpkg/path.h>
+ #include <dpkg/command.h>
+
++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; i<cmd->argc; 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);
++}