about summary refs log tree commit diff
path: root/catgets
diff options
context:
space:
mode:
Diffstat (limited to 'catgets')
-rw-r--r--catgets/catgets.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/catgets/catgets.c b/catgets/catgets.c
index 248b552c91..b11cc597b3 100644
--- a/catgets/catgets.c
+++ b/catgets/catgets.c
@@ -114,6 +114,13 @@ catclose (nl_catd catalog_desc)
 {
   __nl_catd catalog;
 
+  /* Be generous if catalog which failed to be open is used.  */
+  if (catalog_desc == (nl_catd) -1)
+    {
+      __set_errno (EBADF);
+      return -1;
+    }
+
   catalog = (__nl_catd) catalog_desc;
 
 #ifdef _POSIX_MAPPED_FILES