summaryrefslogtreecommitdiffstats
path: root/libtar/extract.c
diff options
context:
space:
mode:
authorDees_Troy <dees_troy@teamw.in>2013-02-27 19:07:32 +0100
committerDees_Troy <dees_troy@teamw.in>2013-02-27 19:19:18 +0100
commitee6632c3e184eb9ee28c4acf2e3bb1ca37a10c16 (patch)
tree1603fea0cb6c3882394f5764a057709aef1229b7 /libtar/extract.c
parentfix restore on mknod (diff)
downloadandroid_bootable_recovery-ee6632c3e184eb9ee28c4acf2e3bb1ca37a10c16.tar
android_bootable_recovery-ee6632c3e184eb9ee28c4acf2e3bb1ca37a10c16.tar.gz
android_bootable_recovery-ee6632c3e184eb9ee28c4acf2e3bb1ca37a10c16.tar.bz2
android_bootable_recovery-ee6632c3e184eb9ee28c4acf2e3bb1ca37a10c16.tar.lz
android_bootable_recovery-ee6632c3e184eb9ee28c4acf2e3bb1ca37a10c16.tar.xz
android_bootable_recovery-ee6632c3e184eb9ee28c4acf2e3bb1ca37a10c16.tar.zst
android_bootable_recovery-ee6632c3e184eb9ee28c4acf2e3bb1ca37a10c16.zip
Diffstat (limited to '')
-rw-r--r--libtar/extract.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/libtar/extract.c b/libtar/extract.c
index 8860e5047..620513c29 100644
--- a/libtar/extract.c
+++ b/libtar/extract.c
@@ -89,7 +89,7 @@ tar_set_file_perms(TAR *t, char *realname)
/* switchboard */
int
-tar_extract_file(TAR *t, char *realname)
+tar_extract_file(TAR *t, char *realname, char *prefix)
{
int i;
char *lnp;
@@ -115,7 +115,7 @@ tar_extract_file(TAR *t, char *realname)
}
else if (TH_ISLNK(t)) {
printf("link\n");
- i = tar_extract_hardlink(t, realname);
+ i = tar_extract_hardlink(t, realname, prefix);
}
else if (TH_ISSYM(t)) {
printf("sym\n");
@@ -300,7 +300,7 @@ tar_skip_regfile(TAR *t)
/* hardlink */
int
-tar_extract_hardlink(TAR * t, char *realname)
+tar_extract_hardlink(TAR * t, char *realname, char *prefix)
{
char *filename;
char *linktgt = NULL;
@@ -325,7 +325,8 @@ tar_extract_hardlink(TAR * t, char *realname)
}
else
linktgt = th_get_linkname(t);
-
+ char *newtgt = strdup(linktgt);
+ sprintf(linktgt, "%s/%s", prefix, newtgt);
#ifdef DEBUG
printf(" ==> extracting: %s (link to %s)\n", filename, linktgt);
#endif