1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-09-20 14:51:42 +02:00

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>
This commit is contained in:
NIIBE Yutaka 2024-09-13 11:01:31 +09:00
parent ff63ffa606
commit b08d990607
No known key found for this signature in database
GPG Key ID: 640114AF89DE6054

View File

@ -936,10 +936,18 @@ do_process_spawn_io (scheme *sc, pointer args)
err = gpgrt_process_spawn (argv[0], (const char **) &argv[1], err = gpgrt_process_spawn (argv[0], (const char **) &argv[1],
flags, NULL, &proc); flags, NULL, &proc);
err = gpgrt_process_get_streams (proc, 0, &infp, NULL, NULL); if (err)
{
xfree (argv);
FFI_RETURN_ERR (sc, err);
}
err = gpgrt_process_get_streams (proc, 0, &infp, NULL, NULL);
if (!err)
{
err = es_write (infp, a_input, strlen (a_input), NULL); err = es_write (infp, a_input, strlen (a_input), NULL);
es_fclose (infp); es_fclose (infp);
}
if (err) if (err)
{ {
gpgrt_process_release (proc); 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); err = gpgrt_process_spawn (argv[0], (const char **)&argv[1], 0, act, &proc);
gpgrt_spawn_actions_release (act); gpgrt_spawn_actions_release (act);
xfree (argv); xfree (argv);
if (err)
FFI_RETURN_ERR (sc, err);
FFI_RETURN_POINTER (sc, proc_wrap (sc, proc)); FFI_RETURN_POINTER (sc, proc_wrap (sc, proc));
} }