diff options
author | Werner Koch <wk@gnupg.org> | 2004-12-06 19:28:56 +0100 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2004-12-06 19:28:56 +0100 |
commit | 0a058ac53c45f65a075aa87d3fd687a685c6a775 (patch) | |
tree | 498a6a7aaeb3e9361dafc0ba43fad60c8e9f6bf2 /common/exechelp.h | |
parent | * configure.ac (have_w32_system): New. Disable Pth checks for W32. (diff) | |
download | gnupg2-0a058ac53c45f65a075aa87d3fd687a685c6a775.tar.xz gnupg2-0a058ac53c45f65a075aa87d3fd687a685c6a775.zip |
* exechelp.h, exechelp.c: New. Based on code from ../sm/import.c.
* gpgsm.c (run_protect_tool) [_WIN32]: Disabled.
* import.c (popen_protect_tool): Simplified by making use of
gnupg_spawn_process.
(parse_p12): Likewise, using gnupg_wait_process.
* export.c (popen_protect_tool): Ditto.
(export_p12): Ditto.
Diffstat (limited to 'common/exechelp.h')
-rw-r--r-- | common/exechelp.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/common/exechelp.h b/common/exechelp.h new file mode 100644 index 000000000..f00d18dd8 --- /dev/null +++ b/common/exechelp.h @@ -0,0 +1,45 @@ +/* exechelp.h - Definitions for the fork and exec helpers + * Copyright (C) 2004 Free Software Foundation, Inc. + * + * This file is part of GnuPG. + * + * GnuPG is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * GnuPG is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#ifndef GNUPG_COMMON_EXECHELP_H +#define GNUPG_COMMON_EXECHELP_H + + + +/* Fork and exec the PGMNAME, connect the file descriptor of INFILE to + stdin, write the output to OUTFILE, return a new stream in + STATUSFILE for stderr and the pid of the process in PID. The + arguments for the process are expected in the NULL terminated array + ARGV. The program name itself should not be included there. if + PREEXEC is not NULL, that function will be called right before the + exec. Returns 0 on success or an error code. */ +gpg_error_t gnupg_spawn_process (const char *pgmname, const char *argv[], + FILE *infile, FILE *outfile, + void (*preexec)(void), + FILE **statusfile, pid_t *pid); + +/* Wait for the process identified by PID to terminate. PGMNAME should + be the same as suplieed to the spawn fucntion and is only used for + diagnostics. Returns 0 if the process succeded, GPG_ERR_GENERAL for + any failures of the spawned program or other error codes.*/ +gpg_error_t gnupg_wait_process (const char *pgmname, pid_t pid); + + +#endif /*GNUPG_COMMON_EXECHELP_H*/ |