Removing "Could not open temporary WARC manifest file." issue in Win builds

This commit is contained in:
Bykov Aleksey 2013-05-17 23:36:36 +03:00 committed by Giuseppe Scrivano
parent 099d8ee3da
commit 5ce9389384
4 changed files with 21 additions and 1 deletions

View File

@ -1,3 +1,7 @@
2013-05-17 Bykov Aleksey <gnfalex@rambler.ru>
* bootstrap: Add `mkostemp'
2012-10-07 Giuseppe Scrivano <gscrivano@gnu.org> 2012-10-07 Giuseppe Scrivano <gscrivano@gnu.org>
* configure.ac: Check for patchconf. * configure.ac: Check for patchconf.

View File

@ -52,6 +52,7 @@ maintainer-makefile
mbtowc mbtowc
mkdir mkdir
mkstemp mkstemp
mkostemp
crypto/md5 crypto/md5
crypto/sha1 crypto/sha1
pipe pipe

View File

@ -1,3 +1,9 @@
2013-05-14 Bykov Aleksey <gnfalex@rambler.ru>
* 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 <tim.ruehsen@gmx.de> 2013-05-14 Tim Ruehsen <tim.ruehsen@gmx.de>
* cookies.c (cookie_jar_load): Replaced read_whole_file() by getline(). * cookies.c (cookie_jar_load): Replaced read_whole_file() by getline().

View File

@ -51,10 +51,16 @@ as that of the covered work. */
#ifndef WINDOWS #ifndef WINDOWS
#include <libgen.h> #include <libgen.h>
#else
#include <fcntl.h>
#endif #endif
#include "warc.h" #include "warc.h"
#ifndef O_TEMPORARY
#define O_TEMPORARY 0
#endif
extern char *version_string; extern char *version_string;
/* Set by main in main.c */ /* Set by main in main.c */
@ -1147,12 +1153,15 @@ warc_tempfile (void)
if (path_search (filename, 100, opt.warc_tempdir, "wget", true) == -1) if (path_search (filename, 100, opt.warc_tempdir, "wget", true) == -1)
return NULL; return NULL;
int fd = mkstemp (filename); int fd = mkostemp (filename, O_TEMPORARY);
if (fd < 0) if (fd < 0)
return NULL; return NULL;
#if !O_TEMPORARY
if (unlink (filename) < 0) if (unlink (filename) < 0)
return NULL; return NULL;
#endif
return fdopen (fd, "wb+"); return fdopen (fd, "wb+");
} }