From 67f9d92478936146ab684913ef69d7cd86293c04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Gregorczyk?= Date: Fri, 30 Sep 2016 12:09:50 -0700 Subject: [PATCH] Do not use bare file descriptors Reviewed By: nadavrot Differential Revision: D3945330 fbshipit-source-id: f3a28e2632c7f17a0b6394f3dd3de183bc9e97af --- ReactCommon/cxxreact/JSCExecutor.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/ReactCommon/cxxreact/JSCExecutor.cpp b/ReactCommon/cxxreact/JSCExecutor.cpp index b074a2339..e92795b44 100644 --- a/ReactCommon/cxxreact/JSCExecutor.cpp +++ b/ReactCommon/cxxreact/JSCExecutor.cpp @@ -278,11 +278,7 @@ void JSCExecutor::loadApplicationScript( int fd = open((bundlePath + UNPACKED_BYTECODE_SUFFIX).c_str(), O_RDONLY); folly::checkUnixError(fd, "Couldn't open compiled bundle"); SCOPE_EXIT { close(fd); }; - - auto length = lseek(fd, 0, SEEK_END); - folly::checkUnixError(length, "Couldn't seek to the end of compiled bundle"); - - sourceCode = JSCreateCompiledSourceCode(fd, length, jsSourceURL); + sourceCode = JSCreateCompiledSourceCode(fd, jsSourceURL); } else { auto jsScriptBigString = JSBigMmapString::fromOptimizedBundle(bundlePath); if (jsScriptBigString->encoding() != JSBigMmapString::Encoding::Ascii) { @@ -296,7 +292,6 @@ void JSCExecutor::loadApplicationScript( sourceCode = JSCreateSourceCode( jsScriptBigString->fd(), - jsScriptBigString->size(), jsSourceURL, jsScriptBigString->hash(), true);