summaryrefslogtreecommitdiff
path: root/archival/tar.c
diff options
context:
space:
mode:
authorMark Whitley2001-04-30 18:17:00 +0000
committerMark Whitley2001-04-30 18:17:00 +0000
commit8a633268ef478a31bd649d582ce07e9c26a4a03a (patch)
treea90a2bc3c3815f7f0e70f009b9b175736902a848 /archival/tar.c
parent6f343944548c2e41fde4a376e805bf322a8e01c9 (diff)
downloadbusybox-8a633268ef478a31bd649d582ce07e9c26a4a03a.zip
busybox-8a633268ef478a31bd649d582ce07e9c26a4a03a.tar.gz
Made new xreadlink function for libbb and changed applets to use it instead of
readlink(2).
Diffstat (limited to 'archival/tar.c')
-rw-r--r--archival/tar.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/archival/tar.c b/archival/tar.c
index c168564..4bf8004 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -921,16 +921,10 @@ writeTarHeader(struct TarBallInfo *tbInfo, const char *header_name,
header.typeflag = LNKTYPE;
strncpy(header.linkname, tbInfo->hlInfo->name, sizeof(header.linkname));
} else if (S_ISLNK(statbuf->st_mode)) {
- int link_size=0;
- char buffer[BUFSIZ];
+ char *lpath = xreadlink(real_name);
header.typeflag = SYMTYPE;
- link_size = readlink(real_name, buffer, sizeof(buffer) - 1);
- if ( link_size < 0) {
- perror_msg("Error reading symlink '%s'", header.name);
- return ( FALSE);
- }
- buffer[link_size] = '\0';
- strncpy(header.linkname, buffer, sizeof(header.linkname));
+ strncpy(header.linkname, lpath, sizeof(header.linkname));
+ free(lpath);
} else if (S_ISDIR(statbuf->st_mode)) {
header.typeflag = DIRTYPE;
strncat(header.name, "/", sizeof(header.name));