aboutsummaryrefslogtreecommitdiffstats
path: root/src/engine-g13.c
diff options
context:
space:
mode:
authorDaiki Ueno <[email protected]>2015-07-27 07:19:52 +0000
committerWerner Koch <[email protected]>2015-08-25 17:11:30 +0000
commit028a0ef3336c5180797fb247448683195376c007 (patch)
treebc399a9d05095ee3b277dce3eebb50ba437419ea /src/engine-g13.c
parentCleanup layout of gpgme.h (diff)
downloadgpgme-028a0ef3336c5180797fb247448683195376c007.tar.gz
gpgme-028a0ef3336c5180797fb247448683195376c007.zip
Relax ttyname_r error checks
* src/engine-assuan.c (llass_new): Don't treat ttyname_r error as fatal. * src/engine-g13.c (g13_new): Likewise. * src/engine-gpg.c (gpg_new): Likewise. * src/engine-gpgsm.c (gpgsm_new): Likewise. * src/engine-uiserver.c (uiserver_new): Likewise. -- Even though isatty() returns 1, ttyname_r() may fail in many ways, e.g., when /dev/pts is not accessible under chroot. Since all our uses of ttyname_r() require that the function works, we can treat the failure as if isatty() fails. Signed-off-by: Daiki Ueno <[email protected]>
Diffstat (limited to 'src/engine-g13.c')
-rw-r--r--src/engine-g13.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/engine-g13.c b/src/engine-g13.c
index a9717eec..4a7b75c5 100644
--- a/src/engine-g13.c
+++ b/src/engine-g13.c
@@ -286,12 +286,10 @@ g13_new (void **engine, const char *file_name, const char *home_dir)
int rc;
rc = ttyname_r (1, dft_ttyname, sizeof (dft_ttyname));
- if (rc)
- {
- err = gpg_error_from_errno (rc);
- goto leave;
- }
- else
+
+ /* Even though isatty() returns 1, ttyname_r() may fail in many
+ ways, e.g., when /dev/pts is not accessible under chroot. */
+ if (!rc)
{
if (asprintf (&optstr, "OPTION ttyname=%s", dft_ttyname) < 0)
{