diff options
author | Erik Andersen <andersen@codepoet.org> | 2000-04-14 21:45:29 +0000 |
---|---|---|
committer | Erik Andersen <andersen@codepoet.org> | 2000-04-14 21:45:29 +0000 |
commit | 95c1c1e05f290ccbcc2ff863a62bcee5d57bf5c8 (patch) | |
tree | 3b89971f6401d4cf4f8d94d28e8b528bef789486 /archival | |
parent | d5ba77d03ee32b6757005ebd58c04b845b3a151a (diff) |
Fix a tar bug: tar removed leading '/'s for symlink targets.
Fix a syslogd bug: Only the first sizeof(buffer) was read from the
/dev/log socket, causing (for most cases) only every other log item to be logged.
-Erik
Diffstat (limited to 'archival')
-rw-r--r-- | archival/tar.c | 26 |
1 files changed, 2 insertions, 24 deletions
diff --git a/archival/tar.c b/archival/tar.c index 4eda4c61a..9b3cb7d81 100644 --- a/archival/tar.c +++ b/archival/tar.c @@ -493,18 +493,6 @@ readTarHeader(struct TarHeader *rawHeader, struct TarInfo *header) chksum = getOctal(rawHeader->chksum, sizeof(rawHeader->chksum)); header->type = rawHeader->typeflag; header->linkname = rawHeader->linkname; - /* Check for and relativify any absolute paths */ - if ( *(header->linkname) == '/' ) { - static int alreadyWarned=FALSE; - - while (*(header->linkname) == '/') - ++*(header->linkname); - - if (alreadyWarned == FALSE) { - errorMsg("tar: Removing leading '/' from link names\n"); - alreadyWarned = TRUE; - } - } header->devmajor = getOctal(rawHeader->devmajor, sizeof(rawHeader->devmajor)); header->devminor = getOctal(rawHeader->devminor, sizeof(rawHeader->devminor)); @@ -826,7 +814,7 @@ writeTarHeader(struct TarBallInfo *tbInfo, const char *fileName, struct stat *st if (! *header.uname) strcpy(header.uname, "root"); - // FIXME (or most likely not): I break Hard Links + /* WARNING/NOTICE: I break Hard Links */ if (S_ISLNK(statbuf->st_mode)) { char buffer[BUFSIZ]; header.typeflag = SYMTYPE; @@ -834,17 +822,7 @@ writeTarHeader(struct TarBallInfo *tbInfo, const char *fileName, struct stat *st errorMsg("Error reading symlink '%s': %s\n", header.name, strerror(errno)); return ( FALSE); } - if (*buffer=='/') { - static int alreadyWarned=FALSE; - if (alreadyWarned==FALSE) { - errorMsg("tar: Removing leading '/' from link names\n"); - alreadyWarned=TRUE; - } - strncpy(header.linkname, buffer+1, sizeof(header.linkname)); - } - else { - strncpy(header.linkname, buffer, sizeof(header.linkname)); - } + strncpy(header.linkname, buffer, sizeof(header.linkname)); } else if (S_ISDIR(statbuf->st_mode)) { header.typeflag = DIRTYPE; strncat(header.name, "/", sizeof(header.name)); |