Skip to content

Commit 207a30c

Browse files
committed
Don't descend in paths that are symlinks
This is also what tar does. If you do descend you run into trouble because the named directory is not created, and hence all files that are supposed to be created inthere will fail.
1 parent a41cf37 commit 207a30c

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

ChangeLog

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
xx Feb 2010: 1.1.1 Miek Gieben <rdup@miek>
22
* Skip gpg test when gpg is not found (Tom)
33
* Rename strmode() to rdup_strmode for FreeBSD (Charlie Kester)
4-
* Fix when toplevel directory is a symlink (Charlie Kester)
4+
* Dont descend when toplevel directory is a symlink (same behavoir
5+
as Gnu tar)
56

67

78
24 Jan 2010: 1.1.0 Miek Gieben <[email protected]>

crawler.c

+7
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,13 @@ dir_prepend(GTree *t, char *path, GHashTable *u, GHashTable *g)
8282
e.f_target = slink(&e);
8383
e.f_size = e.f_name_size;
8484
e.f_name_size += 4 + strlen(e.f_target);
85+
/* When we encounter a symlink on this level, it is very hard to make this
86+
* backup work, because the target may fall out of the backup. If this
87+
* is the case the entire backup fails. Gnu tar only show the symlink
88+
* and then stops. We do now the same, heance the return FALSE
89+
*/
90+
g_tree_insert(t, (gpointer) entry_dup(&e), VALUE);
91+
return FALSE;
8592
}
8693

8794
g_tree_insert(t, (gpointer) entry_dup(&e), VALUE);

0 commit comments

Comments
 (0)