#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include "mono-stdlib.h"
#ifndef HAVE_MKSTEMP
return -1;
}
-
ret = open (templ, O_RDWR | O_BINARY | O_CREAT | O_EXCL, 0600);
- if (ret == -1 && errno != EEXIST) {
- return -1;
- }
-
if (ret == -1) {
+ if (errno != EEXIST)
+ return -1;
memcpy (templ + len - 6, "XXXXXX", 6);
+ } else {
+ break;
}
} while (count-- > 0);