From a94a0acf7efda0ffafb5d6058a2402dba5b03bd1 Mon Sep 17 00:00:00 2001
From: Koen Holtman <koen.holtman@ieee.org>
Date: Sun, 23 Sep 2012 15:19:03 +0200
Subject: [PATCH 1/5] fix incorrect error reporting on including control file,
 added -1 d option

---
 HISTORY | 9 +++++++++
 afio.1  | 6 ++++++
 afio.c  | 8 +++-----
 3 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/HISTORY b/HISTORY
index aaf9d6a..cee3916 100644
--- a/HISTORY
+++ b/HISTORY
@@ -979,3 +979,12 @@ Closes Debian bug #310806.
 Changed makefile to use $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) out of
 environment variables, these are set in some compile environments.
 Based on report and patch by Jari Aalto.
+
+Version 2.5.1-3:
+
+Fixed bug (introduced in 2.5) of afio giving an error message (and
+nonzero exit) when including a control file in an archive.  Bug
+reported by Ian Campbell.  Closes Debian bug #686613.
+
+Added d letter for the -1 option.
+
diff --git a/afio.1 b/afio.1
index 3c7ba5c..e188444 100644
--- a/afio.1
+++ b/afio.1
@@ -878,6 +878,12 @@ will suppress the printing of all warning messages asssociated with
 .IR M ultivolume
 archive handling, messages like "Output limit reached" and
 "Continuing".
+.B d
+is for ignoring in the exit code any warnings about changed
+files, which will be printed when, on creating an archive, a file that
+is being archived changes while it is being written into the archive,
+where the changing is detected by examining the file modification time
+stamp.
 .B r
 is for ignoring certain warnings during the verify (\-r) operation.
 If this letter is used, some verification errors that are
diff --git a/afio.c b/afio.c
index 20f98a1..1841a83 100644
--- a/afio.c
+++ b/afio.c
@@ -3758,7 +3758,8 @@ out (av)
 
 	/* ASX check if file changed between the begining
 	   and end of the backup */
-	if (*fsname)
+        /* if *fsname==0, it was a control file, so do not check then */
+	if (*fsname!=0)
 	{
 	    struct stat st;
 	    /* I must check fsname !
@@ -3773,13 +3774,10 @@ out (av)
 	        if (st.st_mtime!=sb.sb_mtime)
 	        {
 	            warn (fsname, "File was modified during its backup");
+		    if(index(ignorewarnings,(int)'d')) warnings--;
 	        }
 	    }
 	}
-	else
-	{
-	    warn (name, "ASX no fsname for this name ??");
-        }
 
 	if(aflag && *fsname && ((sb.sb_mode & S_IFMT)==S_IFREG))
 	{
-- 
2.3.4

