Blame SOURCES/wget-1.14-fix-backups-to-work-as-documented.patch

a8b0b1
From c52bbad9e4bad1393a9d6ba37e600d388f5ab419 Mon Sep 17 00:00:00 2001
a8b0b1
From: Giuseppe Scrivano <gscrivano@gnu.org>
a8b0b1
Date: Wed, 10 Jul 2013 20:59:34 +0200
a8b0b1
Subject: [PATCH] Make --backups work as documented
a8b0b1
a8b0b1
---
a8b0b1
 src/http.c    | 6 ------
a8b0b1
 src/options.h | 2 +-
a8b0b1
 src/url.c     | 3 ++-
a8b0b1
 src/url.h     | 6 ++++++
a8b0b1
 4 files changed, 9 insertions(+), 8 deletions(-)
a8b0b1
a8b0b1
diff --git a/src/http.c b/src/http.c
a8b0b1
index 9f274dc..b0c782b 100644
a8b0b1
--- a/src/http.c
a8b0b1
+++ b/src/http.c
a8b0b1
@@ -1641,12 +1641,6 @@ read_response_body (struct http_stat *hs, int sock, FILE *fp, wgint contlen,
a8b0b1
 } while (0)
a8b0b1
 #endif /* def __VMS [else] */
a8b0b1
 
a8b0b1
-/* The flags that allow clobbering the file (opening with "wb").
a8b0b1
-   Defined here to avoid repetition later.  #### This will require
a8b0b1
-   rework.  */
a8b0b1
-#define ALLOW_CLOBBER (opt.noclobber || opt.always_rest || opt.timestamping \
a8b0b1
-                       || opt.dirstruct || opt.output_document)
a8b0b1
-
a8b0b1
 /* Retrieve a document through HTTP protocol.  It recognizes status
a8b0b1
    code, and correctly handles redirections.  It closes the network
a8b0b1
    socket.  If it receives an error from the functions below it, it
a8b0b1
diff --git a/src/options.h b/src/options.h
a8b0b1
index ed38617..0a10c9b 100644
a8b0b1
--- a/src/options.h
a8b0b1
+++ b/src/options.h
a8b0b1
@@ -166,7 +166,7 @@ struct options
a8b0b1
   bool timestamping;		/* Whether to use time-stamping. */
a8b0b1
 
a8b0b1
   bool backup_converted;	/* Do we save pre-converted files as *.orig? */
a8b0b1
-  bool backups;			/* Are numeric backups made? */
a8b0b1
+  int backups;			/* Are numeric backups made? */
a8b0b1
 
a8b0b1
   char *useragent;		/* User-Agent string, which can be set
a8b0b1
 				   to something other than Wget. */
a8b0b1
diff --git a/src/url.c b/src/url.c
a8b0b1
index 5e2b9a3..bf9d697 100644
a8b0b1
--- a/src/url.c
a8b0b1
+++ b/src/url.c
a8b0b1
@@ -1669,11 +1669,12 @@ url_file_name (const struct url *u, char *replaced_filename)
a8b0b1
      2) Retrieval with regetting.
a8b0b1
      3) Timestamping is used.
a8b0b1
      4) Hierarchy is built.
a8b0b1
+     5) Backups are specified.
a8b0b1
 
a8b0b1
      The exception is the case when file does exist and is a
a8b0b1
      directory (see `mkalldirs' for explanation).  */
a8b0b1
 
a8b0b1
-  if ((opt.noclobber || opt.always_rest || opt.timestamping || opt.dirstruct)
a8b0b1
+  if (ALLOW_CLOBBER
a8b0b1
       && !(file_exists_p (fname) && !file_non_directory_p (fname)))
a8b0b1
     {
a8b0b1
       unique = fname;
a8b0b1
diff --git a/src/url.h b/src/url.h
a8b0b1
index b7f4366..cd3782b 100644
a8b0b1
--- a/src/url.h
a8b0b1
+++ b/src/url.h
a8b0b1
@@ -47,6 +47,12 @@ as that of the covered work.  */
a8b0b1
 #define DEFAULT_FTP_PORT 21
a8b0b1
 #define DEFAULT_HTTPS_PORT 443
a8b0b1
 
a8b0b1
+/* The flags that allow clobbering the file (opening with "wb").
a8b0b1
+   Defined here to avoid repetition later.  #### This will require
a8b0b1
+   rework.  */
a8b0b1
+#define ALLOW_CLOBBER (opt.noclobber || opt.always_rest || opt.timestamping \
a8b0b1
+                  || opt.dirstruct || opt.output_document || opt.backups > 0)
a8b0b1
+
a8b0b1
 /* Specifies how, or whether, user auth information should be included
a8b0b1
  * in URLs regenerated from URL parse structures. */
a8b0b1
 enum url_auth_mode {
a8b0b1
-- 
a8b0b1
1.8.3.1
a8b0b1