diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2004-07-20 21:54:18 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2004-07-20 21:54:18 (GMT) |
commit | 0662f8a5eaa19f7eed6978eed1af32563359fb93 (patch) | |
tree | b1038a93a40ba0091f8014f6b626ce0881c019ff /Lib/tarfile.py | |
parent | 13e50fe45349c89325aeba460ef2d9e0efaca27c (diff) | |
download | cpython-0662f8a5eaa19f7eed6978eed1af32563359fb93.zip cpython-0662f8a5eaa19f7eed6978eed1af32563359fb93.tar.gz cpython-0662f8a5eaa19f7eed6978eed1af32563359fb93.tar.bz2 |
SF #846659, fix bufsize violation and GNU longname/longlink extensions
Diffstat (limited to 'Lib/tarfile.py')
-rw-r--r-- | Lib/tarfile.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/tarfile.py b/Lib/tarfile.py index 41257f1..d20107e 100644 --- a/Lib/tarfile.py +++ b/Lib/tarfile.py @@ -353,7 +353,6 @@ class _Stream: if self.mode == "w" and self.buf: if self.type != "tar": self.buf += self.cmp.flush() - self.__write("") # Write remaining blocks to output self.fileobj.write(self.buf) self.buf = "" if self.type == "gz": @@ -1775,6 +1774,8 @@ class TarFile(object): of the longname as size, followed by data blocks, which contain the longname as a null terminated string. """ + name += NUL + tarinfo = TarInfo() tarinfo.name = "././@LongLink" tarinfo.type = type @@ -1783,6 +1784,7 @@ class TarFile(object): # write extended header self.fileobj.write(tarinfo.tobuf()) + self.offset += BLOCKSIZE # write name blocks self.fileobj.write(name) blocks, remainder = divmod(tarinfo.size, BLOCKSIZE) |