Don't bother clearing the Magic string when the magic number
authorDan Gohman <gohman@apple.com>
Thu, 27 May 2010 17:14:10 +0000 (17:14 +0000)
committerDan Gohman <gohman@apple.com>
Thu, 27 May 2010 17:14:10 +0000 (17:14 +0000)
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

lib/System/Unix/Path.inc

index 74596dc6ab066eb7ea3af00c9d43950626b80078..185f7fd66bf39443e5b6f153d5fe729bc7944d2e 100644 (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;
 }