core: Make sure FD_SET is not used with an out of range fd.
[gpgme.git] / src / engine-g13.c
index a9717ee..8f24f4c 100644 (file)
@@ -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)
            {
@@ -770,6 +768,7 @@ struct engine_ops _gpgme_engine_ops_g13 =
 #else
     NULL,                      /* reset */
 #endif
+    NULL,               /* set_status_cb */
     NULL,               /* set_status_handler */
     NULL,              /* set_command_handler */
     NULL,               /* set_colon_line_handler */