diff --git a/common/Makefile.am b/common/Makefile.am index 1db4ec919..54dee54ae 100644 --- a/common/Makefile.am +++ b/common/Makefile.am @@ -88,7 +88,7 @@ common_sources = \ mkdir_p.c mkdir_p.h \ strlist.c strlist.h \ call-gpg.c call-gpg.h \ - sh-exectool.c sh-exectool.h + exectool.c exectool.h if HAVE_W32_SYSTEM common_sources += w32-reg.c w32-afunix.c w32-afunix.h diff --git a/common/sh-exectool.c b/common/exectool.c similarity index 95% rename from common/sh-exectool.c rename to common/exectool.c index 4382536ea..5659f2d18 100644 --- a/common/sh-exectool.c +++ b/common/exectool.c @@ -1,4 +1,4 @@ -/* sh-exectool.c - Utility functions to execute a helper tool +/* exectool.c - Utility functions to execute a helper tool * Copyright (C) 2015 Werner Koch * * This file is part of GnuPG. @@ -216,9 +216,9 @@ copy_buffer_flush (struct copy_buffer *c, estream_t sink) the process' stdout is written to OUTPUT. On error a diagnostic is printed, and an error code returned. */ gpg_error_t -sh_exec_tool_stream (const char *pgmname, const char *argv[], - estream_t input, - estream_t output) +gnupg_exec_tool_stream (const char *pgmname, const char *argv[], + estream_t input, + estream_t output) { gpg_error_t err; pid_t pid; @@ -256,7 +256,7 @@ sh_exec_tool_stream (const char *pgmname, const char *argv[], fds[2].want_read = 1; /* Now read as long as we have something to poll. We continue reading even after EOF or error on stdout so that we get the - other error messages or remaining outout. */ + other error messages or remaining outut. */ while (!fds[1].ignore && !fds[2].ignore) { count = es_poll (fds, DIM(fds), -1); @@ -361,9 +361,9 @@ nop_free (void *ptr) stored at RESULT, a diagnostic is printed, and an error code returned. */ gpg_error_t -sh_exec_tool (const char *pgmname, const char *argv[], - const char *input_string, - char **result, size_t *resultlen) +gnupg_exec_tool (const char *pgmname, const char *argv[], + const char *input_string, + char **result, size_t *resultlen) { gpg_error_t err; estream_t input = NULL; @@ -391,7 +391,7 @@ sh_exec_tool (const char *pgmname, const char *argv[], goto leave; } - err = sh_exec_tool_stream (pgmname, argv, input, output); + err = gnupg_exec_tool_stream (pgmname, argv, input, output); if (err) goto leave; diff --git a/common/sh-exectool.h b/common/exectool.h similarity index 81% rename from common/sh-exectool.h rename to common/exectool.h index 6f511c2d5..e79b7860b 100644 --- a/common/sh-exectool.h +++ b/common/exectool.h @@ -17,8 +17,8 @@ * along with this program; if not, see . */ -#ifndef GNUPG_COMMON_SH_EXECTOOL_H -#define GNUPG_COMMON_SH_EXECTOOL_H +#ifndef GNUPG_COMMON_EXECTOOL_H +#define GNUPG_COMMON_EXECTOOL_H #include @@ -30,17 +30,17 @@ NULL. A hidden Nul is appended to the output. On error NULL is stored at RESULT, a diagnostic is printed, and an error code returned. */ -gpg_error_t sh_exec_tool (const char *pgmname, const char *argv[], - const char *input_string, - char **result, size_t *resultlen); +gpg_error_t gnupg_exec_tool (const char *pgmname, const char *argv[], + const char *input_string, + char **result, size_t *resultlen); /* Run the program PGMNAME with the command line arguments given in the NULL terminates array ARGV. If INPUT is not NULL it will be fed to stdin of the process. stderr is logged using log_info and the process' stdout is written to OUTPUT. On error a diagnostic is printed, and an error code returned. */ -gpg_error_t sh_exec_tool_stream (const char *pgmname, const char *argv[], +gpg_error_t gnupg_exec_tool_stream (const char *pgmname, const char *argv[], estream_t input, estream_t output); -#endif /* GNUPG_COMMON_SH_EXECTOOL_H */ +#endif /* GNUPG_COMMON_EXECTOOL_H */ diff --git a/tools/gpgtar-create.c b/tools/gpgtar-create.c index d8d1d54f1..2fd70190c 100644 --- a/tools/gpgtar-create.c +++ b/tools/gpgtar-create.c @@ -36,7 +36,7 @@ #include #include "i18n.h" -#include "../common/sh-exectool.h" +#include "../common/exectool.h" #include "../common/sysutils.h" #include "gpgtar.h" @@ -937,8 +937,8 @@ gpgtar_create (char **inpattern, int encrypt, int sign) + 1 + !!encrypt + !!sign + 2 * !!opt.user + !!opt.symmetric); - err = sh_exec_tool_stream (opt.gpg_program, argv, - outstream, cipher_stream); + err = gnupg_exec_tool_stream (opt.gpg_program, argv, + outstream, cipher_stream); xfree (argv); if (err) goto leave; diff --git a/tools/gpgtar-extract.c b/tools/gpgtar-extract.c index cb8074ca0..95f2b569b 100644 --- a/tools/gpgtar-extract.c +++ b/tools/gpgtar-extract.c @@ -28,7 +28,7 @@ #include #include "i18n.h" -#include "../common/sh-exectool.h" +#include "../common/exectool.h" #include "../common/sysutils.h" #include "gpgtar.h" @@ -325,8 +325,8 @@ gpgtar_extract (const char *filename, int decrypt) argv[i++] = NULL; assert (i == strlist_length (opt.gpg_arguments) + 2); - err = sh_exec_tool_stream (opt.gpg_program, argv, - cipher_stream, stream); + err = gnupg_exec_tool_stream (opt.gpg_program, argv, + cipher_stream, stream); xfree (argv); if (err) goto leave; diff --git a/tools/gpgtar-list.c b/tools/gpgtar-list.c index 7bf4d494b..25c70d2a5 100644 --- a/tools/gpgtar-list.c +++ b/tools/gpgtar-list.c @@ -26,7 +26,7 @@ #include "i18n.h" #include "gpgtar.h" -#include "../common/sh-exectool.h" +#include "../common/exectool.h" @@ -64,7 +64,7 @@ parse_xoctal (const void *data, size_t length, const char *filename) } else { - log_error ("%s: invalid octal number encountered - assuming 0\n", + log_error ("%s: invalid octal number encountered - assuming 0\n", filename); value = 0; break; @@ -83,7 +83,7 @@ parse_header (const void *record, const char *filename) tar_header_t header; int use_prefix; - use_prefix = (!memcmp (raw->magic, "ustar", 5) + use_prefix = (!memcmp (raw->magic, "ustar", 5) && (raw->magic[5] == ' ' || !raw->magic[5])); @@ -135,7 +135,7 @@ parse_header (const void *record, const char *filename) n = 0; memcpy (header->name+n, raw->name, namelen); header->name[n+namelen] = 0; - + header->mode = parse_xoctal (raw->mode, sizeof raw->mode, filename); header->uid = parse_xoctal (raw->uid, sizeof raw->uid, filename); header->gid = parse_xoctal (raw->gid, sizeof raw->gid, filename); @@ -161,7 +161,7 @@ parse_header (const void *record, const char *filename) header->nrecords = (header->size + RECORDSIZE-1)/RECORDSIZE; else header->nrecords = 0; - + return header; } @@ -325,8 +325,8 @@ gpgtar_list (const char *filename, int decrypt) argv[i++] = NULL; assert (i == strlist_length (opt.gpg_arguments) + 2); - err = sh_exec_tool_stream (opt.gpg_program, argv, - cipher_stream, stream); + err = gnupg_exec_tool_stream (opt.gpg_program, argv, + cipher_stream, stream); xfree (argv); if (err) goto leave;