]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
script: fix passing args to execlp()
authorJakub Wilk <jwilk@jwilk.net>
Tue, 1 Mar 2022 16:15:45 +0000 (17:15 +0100)
committerJakub Wilk <jwilk@jwilk.net>
Tue, 1 Mar 2022 16:15:45 +0000 (17:15 +0100)
Fixes:

    $ SHELL=bash script -q -c 'echo Hello world'
    -c: echo Hello world: No such file or directory

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
term-utils/script.c

index ec9536477e7fb376a42f3f98b035b54305f052c7..e106a9019baa5c9d850887786dfbfb4fb32fe270 100644 (file)
@@ -984,9 +984,9 @@ int main(int argc, char **argv)
                                execl(shell, shname, "-i", (char *)NULL);
                } else {
                        if (ctl.command)
-                               execlp(shname, "-c", ctl.command, (char *)NULL);
+                               execlp(shname, shname, "-c", ctl.command, (char *)NULL);
                        else
-                               execlp(shname, "-i", (char *)NULL);
+                               execlp(shname, shname, "-i", (char *)NULL);
                }
 
                err(EXIT_FAILURE, "failed to execute %s", shell);