summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2024-09-13 04:01:31 +0200
committerNIIBE Yutaka <gniibe@fsij.org>2024-09-13 04:01:31 +0200
commitb08d990607b667e3115bdec24217570b7234b09b (patch)
tree68bd7707094f6cb2b9e53db23efe05129ae03f87 /tests
parentPost release updates (diff)
downloadgnupg2-b08d990607b667e3115bdec24217570b7234b09b.tar.xz
gnupg2-b08d990607b667e3115bdec24217570b7234b09b.zip
tests:gpgscm: Raise an error correctly for process spawning.
* tests/gpgscm/ffi.c (do_process_spawn_io): Handle ERR. (do_process_spawn_fd): Likewise. -- Reported-by: Marcel Telka <marcel@telka.sk> Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/gpgscm/ffi.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/tests/gpgscm/ffi.c b/tests/gpgscm/ffi.c
index 16d9147bf..1179e01c0 100644
--- a/tests/gpgscm/ffi.c
+++ b/tests/gpgscm/ffi.c
@@ -936,10 +936,18 @@ do_process_spawn_io (scheme *sc, pointer args)
err = gpgrt_process_spawn (argv[0], (const char **) &argv[1],
flags, NULL, &proc);
- err = gpgrt_process_get_streams (proc, 0, &infp, NULL, NULL);
+ if (err)
+ {
+ xfree (argv);
+ FFI_RETURN_ERR (sc, err);
+ }
- err = es_write (infp, a_input, strlen (a_input), NULL);
- es_fclose (infp);
+ err = gpgrt_process_get_streams (proc, 0, &infp, NULL, NULL);
+ if (!err)
+ {
+ err = es_write (infp, a_input, strlen (a_input), NULL);
+ es_fclose (infp);
+ }
if (err)
{
gpgrt_process_release (proc);
@@ -1198,6 +1206,8 @@ do_process_spawn_fd (scheme *sc, pointer args)
err = gpgrt_process_spawn (argv[0], (const char **)&argv[1], 0, act, &proc);
gpgrt_spawn_actions_release (act);
xfree (argv);
+ if (err)
+ FFI_RETURN_ERR (sc, err);
FFI_RETURN_POINTER (sc, proc_wrap (sc, proc));
}