diff options
author | Werner Koch <[email protected]> | 2023-02-08 07:23:31 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2023-02-08 07:23:31 +0000 |
commit | 3ab6538433fdbed6903e1c5f5b63054e0d056666 (patch) | |
tree | 8f77d14cca72a4e0227671b1258fb2975c2b05f5 /tools/send-mail.c | |
parent | gpg: New list-option --show-unusable-sigs. (diff) | |
download | gnupg-3ab6538433fdbed6903e1c5f5b63054e0d056666.tar.gz gnupg-3ab6538433fdbed6903e1c5f5b63054e0d056666.zip |
tools: Return a better error message if sendmail is not usable.
* tools/send-mail.c: Include unistd.h
(run_sendmail): Check for bad sendmail.
--
GnuPG-bug-id: 6321
Diffstat (limited to 'tools/send-mail.c')
-rw-r--r-- | tools/send-mail.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/send-mail.c b/tools/send-mail.c index 6492c43c1..d348f28cb 100644 --- a/tools/send-mail.c +++ b/tools/send-mail.c @@ -22,6 +22,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <unistd.h> /* for X_OK */ #include "../common/util.h" #include "../common/exectool.h" @@ -36,6 +37,12 @@ run_sendmail (estream_t data) const char pgmname[] = NAME_OF_SENDMAIL; const char *argv[3]; + if (!*pgmname || gnupg_access (pgmname, X_OK)) + { + log_error ("sendmail tool '%s' is not correctly installed\n", pgmname); + return gpg_error (GPG_ERR_ENOENT); + } + argv[0] = "-oi"; argv[1] = "-t"; argv[2] = NULL; |