diff --git a/gpgme/ChangeLog b/gpgme/ChangeLog index 5c31489e..b6900877 100644 --- a/gpgme/ChangeLog +++ b/gpgme/ChangeLog @@ -1,3 +1,9 @@ +2007-04-30 Marcus Brinkmann + + * engine-gpgsm.c (gpgsm_new): Fix error handling for ttyname_r. + * rungpg.c (gpg_new): Likewise. + Submitted by Stephen Tether. + 2007-02-26 Werner Koch * verify.c (op_data_t): New element PLAINTEXT_SEEN. diff --git a/gpgme/engine-gpgsm.c b/gpgme/engine-gpgsm.c index 7bb71cf2..02f506ca 100644 --- a/gpgme/engine-gpgsm.c +++ b/gpgme/engine-gpgsm.c @@ -448,9 +448,12 @@ gpgsm_new (void **engine, const char *file_name, const char *home_dir) if (isatty (1)) { - if (ttyname_r (1, dft_ttyname, sizeof (dft_ttyname))) + int rc; + + rc = ttyname_r (1, dft_ttyname, sizeof (dft_ttyname)); + if (rc) { - err = gpg_error_from_errno (errno); + err = gpg_error_from_errno (rc); goto leave; } else diff --git a/gpgme/rungpg.c b/gpgme/rungpg.c index 58ab39d8..d6fd8fe1 100644 --- a/gpgme/rungpg.c +++ b/gpgme/rungpg.c @@ -476,7 +476,10 @@ gpg_new (void **engine, const char *file_name, const char *home_dir) if (isatty (1)) { - if (ttyname_r (1, dft_ttyname, sizeof (dft_ttyname))) + int err; + + err = ttyname_r (1, dft_ttyname, sizeof (dft_ttyname)); + if (err) rc = gpg_error_from_errno (errno); else {