Reintroduce a check in edit_fnc.
authorMarcus Brinkmann <mb@g10code.com>
Tue, 27 May 2003 01:39:18 +0000 (01:39 +0000)
committerMarcus Brinkmann <mb@g10code.com>
Tue, 27 May 2003 01:39:18 +0000 (01:39 +0000)
tests/gpg/t-edit.c

index d66933f0a2922faef13c5843fe3de9680cf31f6b..74f0cde4c5065c404f0704c55a0becc85d17ed62 100644 (file)
@@ -77,29 +77,32 @@ edit_fnc (void *opaque, gpgme_status_code_t status, const char *args, int fd)
   flush_data (out); 
 
   fprintf (stdout, "[-- Code: %i, %s --]\n", status, args);
-  if (!strcmp (args, "keyedit.prompt"))
-    {
-      static int step = 0;
 
-      switch (step)
+  if (fd >= 0)
+    {
+      if (!strcmp (args, "keyedit.prompt"))
        {
-       case 0:
-         result = "fpr";
-         break;
-       case 1:
-         result = "expire";
-         break;
-       default:
-         result = "quit";
-         break;
+         static int step = 0;
+         
+         switch (step)
+           {
+           case 0:
+             result = "fpr";
+             break;
+           case 1:
+             result = "expire";
+             break;
+           default:
+             result = "quit";
+             break;
+           }
+         step++;
        }
-      step++;
+      else if (!strcmp (args, "keyedit.save.okay"))
+       result = "Y";
+      else if (!strcmp (args, "keygen.valid"))
+       result = "0";
     }
-  else if (!strcmp (args, "keyedit.save.okay"))
-    result = "Y";
-  else if (!strcmp (args, "keygen.valid"))
-    result = "0";
 
   if (result)
     {