summary refs log tree commit diff
path: root/sysdeps/posix
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/posix')
-rw-r--r--sysdeps/posix/tempname.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/sysdeps/posix/tempname.c b/sysdeps/posix/tempname.c
index 61774a0b3e..bb921c172f 100644
--- a/sysdeps/posix/tempname.c
+++ b/sysdeps/posix/tempname.c
@@ -254,6 +254,22 @@ __stdio_gen_tempname (char *buf, size_t bufsize, const char *dir,
 	      (*streamptr)->__mode.__binary = 1;
 #endif
 	    }
+#if defined EMFILE || defined ENFILE || defined EINTR
+	  else if (0
+# ifdef EMFILE
+		   || errno == EMFILE
+# endif
+# ifdef ENFILE
+		   || errno == ENFILE
+# endif
+# ifdef EINTR
+		   || errno == EINTR
+# endif
+		   )
+	    /* We cannot open anymore files since all descriptors are
+	       used or because we got a signal.  */
+	    return NULL;
+#endif
 	  else
 	    continue;
 	}