2007-04-30 Marcus Brinkmann <marcus@g10code.de>
authorMarcus Brinkmann <mb@g10code.com>
Mon, 30 Apr 2007 18:37:22 +0000 (18:37 +0000)
committerMarcus Brinkmann <mb@g10code.com>
Mon, 30 Apr 2007 18:37:22 +0000 (18:37 +0000)
* engine-gpgsm.c (gpgsm_new): Fix error handling for ttyname_r.
* rungpg.c (gpg_new): Likewise.
Submitted by Stephen Tether.

trunk/gpgme/ChangeLog
trunk/gpgme/engine-gpgsm.c
trunk/gpgme/rungpg.c

index 5c31489ee7c0cab28adb09ba015b5b981515f3d4..b6900877f94fdbc6c403f4ad3bbe7f9758d4cadd 100644 (file)
@@ -1,3 +1,9 @@
+2007-04-30  Marcus Brinkmann  <marcus@g10code.de>
+
+       * 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  <wk@g10code.com>
 
        * verify.c (op_data_t): New element PLAINTEXT_SEEN.
index 7bb71cf240f1e217599aeb3e927b1ba0a6096ced..02f506ca7df20fe89dbe6582340c3f9873a8270f 100644 (file)
@@ -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
index 58ab39d8b24313197cf7893da8ffe1e4efcd9b28..d6fd8fe1c3a6c981adfcbcad17acc1bbf1d94989 100644 (file)
@@ -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
        {