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

[patch] nodump breakage on linux



Hi all,

I spent many hours scratching my head trying to figure out what the tarsnap
code was doing wrong to not handle nodump properly, and then Ralph Smith sent
me an email pointing out that tarsnap was checking for the nodump flag on the
wrong file. :-/

I've attached a patch which works in my tests; assuming nobody replies to say
that it isn't working for them, I'll be including this in the next tarsnap
release.

-- 
Colin Percival
Security Officer, FreeBSD | freebsd.org | The power to serve
Founder / author, Tarsnap | tarsnap.com | Online backups for the truly paranoid

--- tar/write.c	2011-11-17 01:32:22.000000000 -0800
+++ tar/write.c	2011-11-30 08:04:07.000000000 -0800
@@ -850,7 +850,8 @@
 #if defined(EXT2_IOC_GETFLAGS) && defined(EXT2_NODUMP_FL)
 		/* Linux uses ioctl to read flags. */
 		if (bsdtar->option_honor_nodump) {
-			int fd = open(name, O_RDONLY | O_NONBLOCK);
+			int fd = open(tree_current_access_path(tree),
+			    O_RDONLY | O_NONBLOCK);
 			if (fd >= 0) {
 				unsigned long fflags;
 				int r = ioctl(fd, EXT2_IOC_GETFLAGS, &fflags);