[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-wget] [PATCH] warc: Fix UUID generation on FreeBSD
From: |
Giuseppe Scrivano |
Subject: |
[Bug-wget] [PATCH] warc: Fix UUID generation on FreeBSD |
Date: |
Sun, 22 Jun 2014 15:31:48 +0200 |
---
Reported off-list by Alex Zimnitsky <address@hidden>.
ChangeLog | 4 ++++
configure.ac | 6 ++++++
src/ChangeLog | 7 +++++++
src/warc.c | 10 +++++++++-
4 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index 29891b7..ff13471 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2014-06-22 Giuseppe Scrivano <address@hidden>
+
+ * configure.ac: Add check for uuid_create.
+
2014-06-11 Giuseppe Scrivano <address@hidden>
* NEWS: Remove repeated word.
diff --git a/configure.ac b/configure.ac
index 029b2fe..abc92fb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -541,6 +541,12 @@ fi
dnl
dnl Check for UUID
dnl
+AC_CHECK_HEADER(uuid.h,
+ AC_CHECK_FUNC(uuid, uuid_create,
+ [AC_DEFINE([HAVE_UUID_CREATE], 1,
+ [Define if uuid_create is available.])
+ ])
+)
AC_CHECK_HEADER(uuid/uuid.h,
AC_CHECK_LIB(uuid, uuid_generate,
diff --git a/src/ChangeLog b/src/ChangeLog
index f64ab76..a8fd411 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,10 @@
+2014-06-22 Giuseppe Scrivano <address@hidden>
+
+ * warc.c [HAVE_UUID_CREATE]: Include <uuid.h>
+ (warc_uuid_str) [HAVE_UUID_CREATE]: Use uuid_create and
+ uuid_to_string to generate the UUID.
+ Reported by: Alex Zimnitsky <address@hidden>
+
2014-06-22 Darshit Shah <address@hidden> (tiny change)
* progress.c (create_image): Align percentage download output better.
diff --git a/src/warc.c b/src/warc.c
index e3e76d0..34613ec 100644
--- a/src/warc.c
+++ b/src/warc.c
@@ -44,8 +44,11 @@ as that of the covered work. */
#ifdef HAVE_LIBZ
#include <zlib.h>
#endif
+
#ifdef HAVE_LIBUUID
#include <uuid/uuid.h>
+#elif HAVE_UUID_CREATE
+#include <uuid.h>
#endif
#ifndef WINDOWS
@@ -594,7 +597,7 @@ warc_timestamp (char *timestamp)
strftime (timestamp, 21, "%Y-%m-%dT%H:%M:%SZ", timeinfo);
}
-#ifdef HAVE_LIBUUID
+#if HAVE_LIBUUID || HAVE_UUID_CREATE
/* Fills urn_str with a UUID in the format required
for the WARC-Record-Id header.
The string will be 47 characters long. */
@@ -604,8 +607,13 @@ warc_uuid_str (char *urn_str)
char uuid_str[37];
uuid_t record_id;
+#if HAVE_UUID_CREATE
+ uuid_create (&record_id, NULL);
+ uuid_to_string (&record_id, &uuid_str, NULL);
+#else
uuid_generate (record_id);
uuid_unparse (record_id, uuid_str);
+#endif
sprintf (urn_str, "<urn:uuid:%s>", uuid_str);
}
--
1.9.3
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Bug-wget] [PATCH] warc: Fix UUID generation on FreeBSD,
Giuseppe Scrivano <=