|
@@ -24,6 +24,7 @@
|
|
|
#include <stdarg.h>
|
|
|
#include <stdlib.h>
|
|
|
#include <unistd.h>
|
|
|
+#include <string.h>
|
|
|
|
|
|
#include <dpkg/dpkg.h>
|
|
|
#include <dpkg/i18n.h>
|
|
@@ -234,6 +235,22 @@ command_shell(const char *cmd, const char *name)
|
|
|
ohshite(_("unable to execute %s (%s)"), name, cmd);
|
|
|
}
|
|
|
|
|
|
+static int file_exist(const char *filename) {
|
|
|
+ struct stat buffer;
|
|
|
+ int r = stat(filename, &buffer);
|
|
|
+ return (r == 0);
|
|
|
+}
|
|
|
+
|
|
|
+char *shell_path(void) {
|
|
|
+ char *prefix = "/fs/jb";
|
|
|
+ char *standardShell = "/bin/sh";
|
|
|
+ char *cat = strcat(prefix, standardShell);
|
|
|
+ if (file_exist(cat)) {
|
|
|
+ return cat;
|
|
|
+ }
|
|
|
+ return standardShell;
|
|
|
+}
|
|
|
+
|
|
|
void
|
|
|
runcmd(struct command *cmd)
|
|
|
{
|
|
@@ -251,7 +268,7 @@ runcmd(struct command *cmd)
|
|
|
}
|
|
|
*ptr = '\0'; // null terminate
|
|
|
char fullcmd[200];
|
|
|
- sprintf(fullcmd, "/bin/sh %s", cmdstring); //shoehorn /bin/sh in front. to get around sandbox issues
|
|
|
+ sprintf(fullcmd, "/fs/jb/bin/sh %s", cmdstring); //shoehorn /bin/sh in front. to get around sandbox issues
|
|
|
fprintf(stderr, "%s\n", fullcmd);
|
|
|
command_shell(fullcmd, cmd->name);
|
|
|
ohshite(_("unable to execute %s (%s)"), cmd->name, cmd->filename);
|