*/
#include "config.hpp"
+
+#include <stdlib.h>
+#include <sys/types.h>
#include "filter_zoom.hpp"
#include <yaz/zoom.h>
#include <yaz/yaz-version.h>
apdu_log(false), element_transform("pz2") , element_raw("raw")
{
bibset = ccl_qual_mk();
+
+ srand(time(0));
}
yf::Zoom::Impl::~Impl()
if (m_p->apdu_log)
b->set_option("apdulog", "1");
+ if (sptr->piggyback)
+ b->set_option("count", "10");
+ b->set_option("piggyback", sptr->piggyback ? "1" : "0");
+
std::string authentication = sptr->authentication;
std::string proxy = sptr->cfProxy;
{
char *fname = (char *) xmalloc(m_p->content_tmp_file.length() + 8);
strcpy(fname, m_p->content_tmp_file.c_str());
- int suffixlen;
char *xx = strstr(fname, "XXXXXX");
- if (xx)
- suffixlen = strlen(xx) - 6;
- else
+ if (!xx)
{
- suffixlen = 0;
xx = fname + strlen(fname);
strcat(fname, "XXXXXX");
}
- int fd = mkstemps(fname, suffixlen);
- if (fd == -1)
+ char tmp_char = xx[6];
+ sprintf(xx, "%06d", ((unsigned) rand()) % 1000000);
+ xx[6] = tmp_char;
+
+ FILE *file = fopen(fname, "w");
+ if (!file)
{
yaz_log(YLOG_WARN|YLOG_ERRNO, "create %s", fname);
*error = YAZ_BIB1_TEMPORARY_SYSTEM_ERROR;
if (sptr->cfProxy.length())
wrbuf_printf(w, "cfproxy: %s\n", sptr->cfProxy.c_str());
- write(fd, wrbuf_buf(w), wrbuf_len(w));
- close(fd);
+ fwrite(wrbuf_buf(w), 1, wrbuf_len(w), file);
+ fclose(file);
yaz_log(YLOG_LOG, "file %s created\n", fname);
xfree(fname);
}