summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2010-09-20 11:34:33 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2010-09-20 11:35:04 -0700
commitefe26f98ec84856025f56673639d6bd520aa2e64 (patch)
treefc93f8874e322de1fd59ea6e2e84d1a5da313c34
parent4bde4f39d08f000f7e63a832b08a2525c1262f84 (diff)
downloadtar-efe26f98ec84856025f56673639d6bd520aa2e64.tar.gz
tar: do not crash with --listed-incremental
Problem reported by Frantisek Hanzlik in <https://bugzilla.redhat.com/635318> via Kamil Dudka in <http://lists.gnu.org/archive/html/bug-tar/2010-09/msg00066.html>. I don't understand this code either, but Sergey can take a look at this patch, and perhaps install a better one, when he has the time. * src/incremen.c (append_incremental_renames): Don't actually append anything to DIR if DIR is null.
-rw-r--r--src/incremen.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/incremen.c b/src/incremen.c
index c6d4f4c5..4d86ed79 100644
--- a/src/incremen.c
+++ b/src/incremen.c
@@ -890,7 +890,8 @@ append_incremental_renames (struct directory *dir)
for (dp = dirhead; dp; dp = dp->next)
store_rename (dp, &stk);
- if (obstack_object_size (&stk) != size)
+ /* FIXME: Is this the right thing to do when DIR is null? */
+ if (dir && obstack_object_size (&stk) != size)
{
obstack_1grow (&stk, 0);
dumpdir_free (dir->dump);