diff options
author | Werner Koch <[email protected]> | 2024-06-05 08:31:21 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2024-06-05 08:31:21 +0000 |
commit | 60b9a68def583d7c3a1d47daec717a7f71233c55 (patch) | |
tree | 2f2e9ec0ba9bab3d1d33fd8353d60d740539ee3f /src/spawn-posix.c | |
parent | spawn: Expose spawn functions API. (diff) | |
download | libgpg-error-60b9a68def583d7c3a1d47daec717a7f71233c55.tar.gz libgpg-error-60b9a68def583d7c3a1d47daec717a7f71233c55.zip |
spawn: Avoid bumping the error counter.
* src/spawn-posix.c: Use log_info instead of log_error.
* src/spawn-w32.c: Ditto.
(spawn_detached): Fix copying of hd[2]
(_gpgrt_process_spawn): Ditto.
--
The spawn function might be used to run helper processes which are
non-critical for the operation of the program. For example to display
help. Bumping the error counter via gpgrt_log_error would then let
the entire program fail which might be surprising. It is better to
just print an informational message and let the caller decide what to
do with the returned error code.
Diffstat (limited to 'src/spawn-posix.c')
-rw-r--r-- | src/spawn-posix.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/spawn-posix.c b/src/spawn-posix.c index 67a118f..e06cb48 100644 --- a/src/spawn-posix.c +++ b/src/spawn-posix.c @@ -217,7 +217,7 @@ do_create_pipe_and_estream (int filedes[2], estream_t *r_fp, if (pipe (filedes) == -1) { err = _gpg_err_code_from_syserror (); - _gpgrt_log_error (_("error creating a pipe: %s\n"), _gpg_strerror (err)); + _gpgrt_log_info (_("error creating a pipe: %s\n"), _gpg_strerror (err)); filedes[0] = filedes[1] = -1; *r_fp = NULL; return err; @@ -231,7 +231,7 @@ do_create_pipe_and_estream (int filedes[2], estream_t *r_fp, if (!*r_fp) { err = _gpg_err_code_from_syserror (); - _gpgrt_log_error (_("error creating a stream for a pipe: %s\n"), + _gpgrt_log_info (_("error creating a stream for a pipe: %s\n"), _gpg_strerror (err)); close (filedes[0]); close (filedes[1]); @@ -361,7 +361,7 @@ spawn_detached (const char *pgmname, const char *argv[], if (pid == (pid_t)(-1)) { ec = _gpg_err_code_from_syserror (); - _gpgrt_log_error (_("error forking process: %s\n"), _gpg_strerror (ec)); + _gpgrt_log_info (_("error forking process: %s\n"), _gpg_strerror (ec)); xfree (argv); return ec; } @@ -388,7 +388,7 @@ spawn_detached (const char *pgmname, const char *argv[], { _gpgrt_post_syscall (); ec = _gpg_err_code_from_syserror (); - _gpgrt_log_error ("waitpid failed in gpgrt_spawn_process_detached: %s", + _gpgrt_log_info ("waitpid failed in gpgrt_spawn_process_detached: %s", _gpg_strerror (ec)); return ec; } @@ -636,7 +636,7 @@ _gpgrt_process_spawn (const char *pgmname, const char *argv1[], if (pid == (pid_t)(-1)) { ec = _gpg_err_code_from_syserror (); - _gpgrt_log_error (_("error forking process: %s\n"), _gpg_strerror (ec)); + _gpgrt_log_info (_("error forking process: %s\n"), _gpg_strerror (ec)); if (fd_in[0] >= 0 && fd_in[0] != 0) close (fd_in[0]); if (fd_in[1] >= 0) @@ -889,7 +889,7 @@ _gpgrt_process_wait (gpgrt_process_t process, int hang) if (pid == (pid_t)(-1)) { ec = _gpg_err_code_from_syserror (); - _gpgrt_log_error (_("waiting for process %d to terminate failed: %s\n"), + _gpgrt_log_info (_("waiting for process %d to terminate failed: %s\n"), (int)pid, _gpg_strerror (ec)); } else if (!pid) |