From 5ce93893843788edb28521e91b80bcb15f776a62 Mon Sep 17 00:00:00 2001 From: Bykov Aleksey Date: Fri, 17 May 2013 23:36:36 +0300 Subject: [PATCH] Removing "Could not open temporary WARC manifest file." issue in Win builds --- ChangeLog | 4 ++++ bootstrap.conf | 1 + src/ChangeLog | 6 ++++++ src/warc.c | 11 ++++++++++- 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 104ca3cb..62c36d42 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-05-17 Bykov Aleksey + + * bootstrap: Add `mkostemp' + 2012-10-07 Giuseppe Scrivano * configure.ac: Check for patchconf. diff --git a/bootstrap.conf b/bootstrap.conf index efb1bc21..516bbb61 100644 --- a/bootstrap.conf +++ b/bootstrap.conf @@ -52,6 +52,7 @@ maintainer-makefile mbtowc mkdir mkstemp +mkostemp crypto/md5 crypto/sha1 pipe diff --git a/src/ChangeLog b/src/ChangeLog index fd037a1d..32f3b824 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2013-05-14 Bykov Aleksey + + * warc.c (warc_tempfile): For fix "Could not open temporary WARC manifest + file." issue in Win system force to use `mkostemp(filename, O_TEMPORARY)' + instead of `mkstemp(filename)'. Thank to Angel Gonzalez for help. + 2013-05-14 Tim Ruehsen * cookies.c (cookie_jar_load): Replaced read_whole_file() by getline(). diff --git a/src/warc.c b/src/warc.c index 916b53df..9202e8d2 100644 --- a/src/warc.c +++ b/src/warc.c @@ -51,10 +51,16 @@ as that of the covered work. */ #ifndef WINDOWS #include +#else +#include #endif #include "warc.h" +#ifndef O_TEMPORARY +#define O_TEMPORARY 0 +#endif + extern char *version_string; /* Set by main in main.c */ @@ -1147,12 +1153,15 @@ warc_tempfile (void) if (path_search (filename, 100, opt.warc_tempdir, "wget", true) == -1) return NULL; - int fd = mkstemp (filename); + int fd = mkostemp (filename, O_TEMPORARY); if (fd < 0) return NULL; +#if !O_TEMPORARY if (unlink (filename) < 0) return NULL; +#endif + return fdopen (fd, "wb+"); } -- 2.39.2