From b4de69ed5c26ebecab7a81fd88fb5dc0ff73d11a Mon Sep 17 00:00:00 2001 From: KLuka Date: Fri, 17 Jul 2015 13:42:56 +0200 Subject: [PATCH] Fixed option --service for running custom scripts * Full path of command is passed to function execvp(), when we launch user defined service. This was broken since commit b3309b2. --- shellinabox/launcher.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shellinabox/launcher.c b/shellinabox/launcher.c index 67aa48a..6256d95 100644 --- a/shellinabox/launcher.c +++ b/shellinabox/launcher.c @@ -1446,6 +1446,8 @@ static void execService(int width ATTR_UNUSED, int height ATTR_UNUSED, extern char **environ; environ = environment; + char *cmd; + check(cmd = strdup(argv[0])); char *slash = strrchr(argv[0], '/'); if (slash) { memmove(argv[0], slash + 1, strlen(slash)); @@ -1457,8 +1459,6 @@ static void execService(int width ATTR_UNUSED, int height ATTR_UNUSED, argv[0][0] = '-'; argv[0][len + 1] = '\000'; } - char *cmd; - check(cmd = strdup(argv[0])); if (execvp(cmd, argv) < 0) { free(argv); free(cmd);