diff options
author | markw <markw@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2001-04-30 18:17:00 +0000 |
---|---|---|
committer | markw <markw@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2001-04-30 18:17:00 +0000 |
commit | db1ea6ee76a5106c45398bdc17c2db04da99ecf7 (patch) | |
tree | a90a2bc3c3815f7f0e70f009b9b175736902a848 /tar.c | |
parent | c9a51e8d05d64580a0f9ccce5b77c5b4ad990541 (diff) | |
download | busybox-w32-db1ea6ee76a5106c45398bdc17c2db04da99ecf7.tar.gz busybox-w32-db1ea6ee76a5106c45398bdc17c2db04da99ecf7.tar.bz2 busybox-w32-db1ea6ee76a5106c45398bdc17c2db04da99ecf7.zip |
Made new xreadlink function for libbb and changed applets to use it instead of
readlink(2).
git-svn-id: svn://busybox.net/trunk/busybox@2495 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'tar.c')
-rw-r--r-- | tar.c | 12 |
1 files changed, 3 insertions, 9 deletions
@@ -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)); |