Keep .plt section and DT_PLTGOT for prelink
[binutils-gdb.git] / libiberty / mkstemps.c
index 6c2e472528babdfd1da3d18afff2e7ba1beb0a2e..0e06fe17059a03c9a0d343beecaa5d60b8dae00d 100644 (file)
@@ -35,6 +35,8 @@
 #endif
 #ifdef HAVE_SYS_TIME_H
 #include <sys/time.h>
+#elif HAVE_TIME_H
+#include <time.h>
 #endif
 #include "ansidecl.h"
 
@@ -127,6 +129,13 @@ mkstemps (char *pattern, int suffix_len)
       if (fd >= 0)
        /* The file does not exist.  */
        return fd;
+      if (errno != EEXIST
+#ifdef EISDIR
+         && errno != EISDIR
+#endif
+        )
+       /* Fatal error (EPERM, ENOSPC etc).  Doesn't make sense to loop.  */
+       break;
 
       /* This is a random value.  It is only necessary that the next
         TMP_MAX values generated by adding 7777 to VALUE are different