Don't bother clearing the Magic string when the magic number

can't be read, since it isn't cleared on other error paths.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104852 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dan Gohman 2010-05-27 17:14:10 +00:00
parent 130de9c0b4
commit 02d5824266

View File

@ -421,10 +421,8 @@ bool Path::getMagicNumber(std::string &Magic, unsigned len) const {
return false;
ssize_t bytes_read = ::read(fd, Buf, len);
::close(fd);
if (ssize_t(len) != bytes_read) {
Magic.clear();
if (ssize_t(len) != bytes_read)
return false;
}
Magic.assign(Buf, len);
return true;
}