chiark / gitweb /
gpg,common: Make sure that all fd given are valid.
[gnupg2.git] / g10 / keylist.c
index 4fe1e403427d4e0892fb457e182662aea6502557..abdcb9f0a4fc6bf237e9e941aa1c8bf7aa90fee1 100644 (file)
@@ -1900,6 +1900,9 @@ set_attrib_fd (int fd)
   if (fd == -1)
     return;
 
+  if (! gnupg_fd_valid (fd))
+    log_fatal ("attribute-fd is invalid: %s\n", strerror (errno));
+
 #ifdef HAVE_DOSISH_SYSTEM
   setmode (fd, O_BINARY);
 #endif