system: Add "--" after "-c" for sh (BZ #28519)
commit868506eb427c9dcc6d869cd4885679be04e1b7dd
authorJoe Simmons-Talbott <josimmon@redhat.com>
Wed, 22 Mar 2023 18:04:30 +0000 (22 14:04 -0400)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Tue, 28 Mar 2023 13:12:30 +0000 (28 10:12 -0300)
tree11233f242405423c14ff09fe781131696d4c73b0
parent31bfe3ef4ea898df606cb6cc59ac72de27002b01
system: Add "--" after "-c" for sh (BZ #28519)

Prevent sh from interpreting a user string as shell options if it
starts with '-' or '+'.  Since the version of /bin/sh used for testing
system() is different from the full-fledged system /bin/sh add support
to it for handling "--" after "-c".  Add a testcase to ensure the
expected behavior.

Signed-off-by: Joe Simmons-Talbott <josimmon@redhat.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
libio/iopopen.c
stdlib/tst-system.c
support/shell-container.c
sysdeps/posix/system.c