From d52f4b86f3e9babaa457bf15be73e92ad82eee31 Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Sat, 7 Jan 2017 08:32:07 +0000 Subject: [PATCH] TarWriter: Use fitsInUstar function. This change should have been commit as part of r291340. llvm-svn: 291341 --- llvm/lib/Support/TarWriter.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/llvm/lib/Support/TarWriter.cpp b/llvm/lib/Support/TarWriter.cpp index 5e45b36771f1..57a4c8f4fc0a 100644 --- a/llvm/lib/Support/TarWriter.cpp +++ b/llvm/lib/Support/TarWriter.cpp @@ -123,7 +123,7 @@ static std::pair splitPath(StringRef Path) { // Returns true if a given path can be stored to a Ustar header // without the PAX extension. -static bool fitInUstar(StringRef Path) { +static bool fitsInUstar(StringRef Path) { StringRef Prefix; StringRef Name; std::tie(Prefix, Name) = splitPath(Path); @@ -172,7 +172,7 @@ TarWriter::TarWriter(int FD, StringRef BaseDir) void TarWriter::append(StringRef Path, StringRef Data) { // Write Path and Data. std::string S = BaseDir + "/" + canonicalize(Path) + "\0"; - if (S.size() <= sizeof(UstarHeader::Name)) { + if (fitsInUstar(S)) { writeUstarHeader(OS, S, Data.size()); } else { writePaxHeader(OS, S);