+ if (info->temp_path)
+ sprintf(template, "%s/", info->temp_path);
+ strcat(template, "zrs_");
+#if HAVE_UNISTD_H
+ sprintf(template + strlen(template), "%ld_", (long) getpid());
+#endif
+ strcat(template, "XXXXXX");
+
+ info->fd = mkstemp(template);
+ if (info->fd == -1)
+ {
+ yaz_log(YLOG_FATAL|YLOG_ERRNO, "rstemp: mkstemp %s", template);
+ zebra_exit("r_flush");
+ }
+ info->fname = nmem_strdup(rfd->rset->nmem, template);
+#else
+ char *s = (char*) tempnam(info->temp_path, "zrs");
+ info->fname= nmem_strdup(rfd->rset->nmem, s);
+
+ yaz_log(log_level, "creating tempfile %s", info->fname);
+ info->fd = open(info->fname, O_BINARY|O_RDWR|O_CREAT, 0666);