summaryrefslogtreecommitdiffstats
path: root/src/tests
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2015-01-07 10:36:12 +0100
committerJakub Hrozek <jhrozek@redhat.com>2015-01-13 21:03:27 +0100
commitdf95d21e5253cec8745329567ab8050bfcd52333 (patch)
tree7302780680fb7d92fef9250ec5bbc64d90166392 /src/tests
parent0af3ec742fd3d160d8b6ccc81a368e851456d61c (diff)
downloadsssd-df95d21e5253cec8745329567ab8050bfcd52333.tar.gz
sssd-df95d21e5253cec8745329567ab8050bfcd52333.tar.xz
sssd-df95d21e5253cec8745329567ab8050bfcd52333.zip
UTIL: Allow dup-ing child pipe to a different FD
Related to: https://fedorahosted.org/sssd/ticket/2544 Adds a new function exec_child_ex and moves setting the extra_argv[] to exec_child_ex() along with specifying the input and output fds. Reviewed-by: Sumit Bose <sbose@redhat.com> (cherry picked from commit 16cb0969f0a9ea71524d852077d6a480740d4f12)
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/cmocka/test_child_common.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/tests/cmocka/test_child_common.c b/src/tests/cmocka/test_child_common.c
index 112ed0ad9..348b3e6c3 100644
--- a/src/tests/cmocka/test_child_common.c
+++ b/src/tests/cmocka/test_child_common.c
@@ -89,7 +89,7 @@ void test_exec_child(void **state)
ret = exec_child(child_tctx,
child_tctx->pipefd_to_child,
child_tctx->pipefd_from_child,
- CHILD_DIR"/"TEST_BIN, 2, NULL);
+ CHILD_DIR"/"TEST_BIN, 2);
assert_int_equal(ret, EOK);
} else {
do {
@@ -128,10 +128,11 @@ void test_exec_child_extra_args(void **state)
child_pid = fork();
assert_int_not_equal(child_pid, -1);
if (child_pid == 0) {
- ret = exec_child(child_tctx,
- child_tctx->pipefd_to_child,
- child_tctx->pipefd_from_child,
- CHILD_DIR"/"TEST_BIN, 2, extra_args);
+ ret = exec_child_ex(child_tctx,
+ child_tctx->pipefd_to_child,
+ child_tctx->pipefd_from_child,
+ CHILD_DIR"/"TEST_BIN, 2, extra_args,
+ STDIN_FILENO, STDOUT_FILENO);
assert_int_equal(ret, EOK);
} else {
do {