aboutsummaryrefslogtreecommitdiff
path: root/archival/tar.c
diff options
context:
space:
mode:
authorMark Whitley <markw@lineo.com>2001-04-30 18:17:00 +0000
committerMark Whitley <markw@lineo.com>2001-04-30 18:17:00 +0000
commit8a633268ef478a31bd649d582ce07e9c26a4a03a (patch)
treea90a2bc3c3815f7f0e70f009b9b175736902a848 /archival/tar.c
parent6f343944548c2e41fde4a376e805bf322a8e01c9 (diff)
downloadbusybox-w32-8a633268ef478a31bd649d582ce07e9c26a4a03a.tar.gz
busybox-w32-8a633268ef478a31bd649d582ce07e9c26a4a03a.tar.bz2
busybox-w32-8a633268ef478a31bd649d582ce07e9c26a4a03a.zip
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 c168564ca..4bf8004ea 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -921,16 +921,10 @@ writeTarHeader(struct TarBallInfo *tbInfo, const char *header_name,
921 header.typeflag = LNKTYPE; 921 header.typeflag = LNKTYPE;
922 strncpy(header.linkname, tbInfo->hlInfo->name, sizeof(header.linkname)); 922 strncpy(header.linkname, tbInfo->hlInfo->name, sizeof(header.linkname));
923 } else if (S_ISLNK(statbuf->st_mode)) { 923 } else if (S_ISLNK(statbuf->st_mode)) {
924 int link_size=0; 924 char *lpath = xreadlink(real_name);
925 char buffer[BUFSIZ];
926 header.typeflag = SYMTYPE; 925 header.typeflag = SYMTYPE;
927 link_size = readlink(real_name, buffer, sizeof(buffer) - 1); 926 strncpy(header.linkname, lpath, sizeof(header.linkname));
928 if ( link_size < 0) { 927 free(lpath);
929 perror_msg("Error reading symlink '%s'", header.name);
930 return ( FALSE);
931 }
932 buffer[link_size] = '\0';
933 strncpy(header.linkname, buffer, sizeof(header.linkname));
934 } else if (S_ISDIR(statbuf->st_mode)) { 928 } else if (S_ISDIR(statbuf->st_mode)) {
935 header.typeflag = DIRTYPE; 929 header.typeflag = DIRTYPE;
936 strncat(header.name, "/", sizeof(header.name)); 930 strncat(header.name, "/", sizeof(header.name));