- {
- size_t len = strlen (xtemplate);
- int o_temporary = (supports_delete_on_close () ? _O_TEMPORARY : 0);
- int fd;
-
- do
- {
- memcpy (&xtemplate[len - 6], "XXXXXX", 6);
- if (gen_tempname (xtemplate, GT_NOCREATE) < 0)
- {
- fd = -1;
- break;
- }
-
- fd = _open (xtemplate,
- _O_CREAT | _O_EXCL | o_temporary
- | _O_RDWR | _O_BINARY,
- _S_IREAD | _S_IWRITE);
- }
- while (fd < 0 && errno == EEXIST);
-
- if (fd >= 0)
- {
- FILE *fp = _fdopen (fd, "w+b");
-
- if (fp != NULL)
- return fp;
- else
- {
- int saved_errno = errno;
- _close (fd);
- errno = saved_errno;
- }
- }
- }
+ {
+ size_t len = strlen (xtemplate);
+ int o_temporary = (supports_delete_on_close () ? _O_TEMPORARY : 0);
+ int fd;
+
+ do
+ {
+ memcpy (&xtemplate[len - 6], "XXXXXX", 6);
+ if (gen_tempname (xtemplate, 0, 0, GT_NOCREATE) < 0)
+ {
+ fd = -1;
+ break;
+ }
+
+ fd = _open (xtemplate,
+ _O_CREAT | _O_EXCL | o_temporary
+ | _O_RDWR | _O_BINARY,
+ _S_IREAD | _S_IWRITE);
+ }
+ while (fd < 0 && errno == EEXIST);
+
+ if (fd >= 0)
+ {
+ FILE *fp = _fdopen (fd, "w+b");
+
+ if (fp != NULL)
+ return fp;
+ else
+ {
+ int saved_errno = errno;
+ _close (fd);
+ errno = saved_errno;
+ }
+ }
+ }