$NetBSD: patch-ae,v 1.3 2006/07/19 22:59:59 wiz Exp $

--- gpgme/engine-gpgsm.c.orig	2005-10-01 20:14:48.000000000 +0000
+++ gpgme/engine-gpgsm.c
@@ -30,6 +30,9 @@
 #include <sys/types.h>
 #include <assert.h>
 #include <unistd.h>
+#if HAVE_RFUNCS_H
+#include <rfuncs.h>
+#endif
 #include <locale.h>
 #include <fcntl.h> /* FIXME */
 #include <errno.h>
@@ -457,7 +460,8 @@ gpgsm_new (void **engine, const char *fi
 
   if (isatty (1))
     {
-      if (ttyname_r (1, dft_ttyname, sizeof (dft_ttyname)))
+      /* ttyname_r() return numeric status */
+      if (err = ttyname_r (1, dft_ttyname, sizeof (dft_ttyname)))
 	{
 	  err = gpg_error_from_errno (errno);
 	  goto leave;
