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

bugfix for ctm



Hi,

as of ctm version ? the program will apply the delta even though a requested backup
failed. The attached patch changes this, the program will rather abort.
It also changes the default tar command to tar -rf %s -I -
which is OpenBSD-current semantics for tar to read files to work on from a file.

Besides, what is the trick to build the deltas?

regards
tilo

diff -ur ctm/ctm/ctm.c ../ctm/ctm/ctm.c
--- ctm/ctm/ctm.c	Mon May 26 18:20:20 2003
+++ ../ctm/ctm/ctm.c	Mon May 26 18:18:27 2003
@@ -298,7 +298,8 @@
     /* backup files if requested */
     if(BackupFile) {
 
-	i = PassB(f);
+	if((i = PassB(f)))
+	    goto exit_and_close;
 
 	if(!p) {
 	    rewind(f);
diff -ur ctm/ctm/ctm.h ../ctm/ctm/ctm.h
--- ctm/ctm/ctm.h	Mon May 26 18:20:20 2003
+++ ../ctm/ctm/ctm.h	Mon May 26 17:51:19 2003
@@ -24,13 +24,14 @@
 #include <sys/stat.h>
 #include <sys/file.h>
 #include <sys/time.h>
+#include <sys/wait.h>	/* wait4(2) macros */
 
 #define VERSION "2.0"
 #define MAXSIZE (1024*1024*100)
 
 #define SUBSUFF ".ctm"
 #define TMPSUFF ".ctmtmp"
-#define TARCMD  "tar -rf %s -T -"
+#define TARCMD  "tar -rf %s -I -"
 
 /* The fields... */
 #define CTM_F_MASK		0xff
diff -ur ctm/ctm/ctm_passb.c ../ctm/ctm/ctm_passb.c
--- ctm/ctm/ctm_passb.c	Mon May 26 18:20:20 2003
+++ ../ctm/ctm/ctm_passb.c	Mon May 26 18:11:50 2003
@@ -125,6 +125,8 @@
     }
 
     ret = pclose(b);
+    if ( WIFEXITED( ret))
+      ret=WEXITSTATUS(ret);
 
     Delete(md5);
     Delete(uid);