bug-wget
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-wget] Wget MinGW/MSYS build issues


From: Alex
Subject: Re: [Bug-wget] Wget MinGW/MSYS build issues
Date: Thu, 14 Mar 2013 15:22:57 +0200
User-agent: Opera Mail/12.14 (Win32)

Greetings
Thanks for correting and testing.
Sorry, my bad (I think, that binary flags is mostly compatible between
systems). In Windows O_TEMPORARY defined in fctl.h. So it's need to also
include additional header
#ifndef WINDOWS
#include <libgen.h>
+#else
+#include <fcntl.h>
#endif

And, sorry, find more situable place to converting in
--filesystem-local-encoding (prev version does not conver directory names)
Both patch are in attachment.

Best regars, Alex

On Thu, 14 Mar 2013 02:55:12 +0200, Ángel González <address@hidden>
wrote:
Oh, cool.
That should work. I saw that mkostemp() was a gnu extension (thus
non-portable), and didn't think in checking if it was available through
gnulib.

I would however do a
#ifndef O_TEMPORARY
#define O_TEMPORARY 0
#endif

(...)
int fd = mkostemp (filename,O_TEMPORARY);

That 0x0040 magic number could have bad effects on some systems.

The unlink() won't be needed for Windows, but will still be needed on
Unix systems.

Modifying your patch a bit, I propose the following (tested on Linux):

diff --git a/bootstrap.conf b/bootstrap.conf
index efb1bc2..516bbb6 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/warc.c b/src/warc.c
index fb506a7..7c9fd64 100644
--- a/src/warc.c
+++ b/src/warc.c
@@ -1134,6 +1134,10 @@ warc_close (void)
     }
 }
+#ifndef O_TEMPORARY
+#define O_TEMPORARY 0
+#endif
+
 /* Creates a temporary file for writing WARC output.
    The temporary file will be created in opt.warc_tempdir.
    Returns the pointer to the temporary file, or NULL. */
@@ -1144,12 +1148,14 @@ 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+");
 }

Attachment: 0002-Removing-Could-not-open-temporary-WARC-manifest-file.patch
Description: Binary data

Attachment: 0001-Add-local-filesystem-encoding-options.patch
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]