Skip to content

Commit

Permalink
Cleaup SbFile usage.
Browse files Browse the repository at this point in the history
Change-Id: Ie0da2d423cb30500608fc434f3d30805174c3945
  • Loading branch information
yjzhang111 committed Jul 13, 2024
1 parent 2ae8495 commit e0f8599
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
7 changes: 3 additions & 4 deletions starboard/loader_app/drain_file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,10 @@ bool TryDrain(const char* dir, const char* app_key) {
path.append(filename);

SbFileError error = kSbFileOk;
SbFile file = SbFileOpen(path.c_str(), kSbFileCreateAlways | kSbFileWrite,
NULL, &error);
int file = open(path.c_str(), O_CREAT | O_WRONLY);

SB_DCHECK(error == kSbFileOk);
SB_DCHECK(SbFileClose(file));
SB_DCHECK(file >= 0);
SB_DCHECK(close(file));

SB_LOG(INFO) << "Created drain file at '" << path << "'";

Expand Down
4 changes: 4 additions & 0 deletions starboard/nplb/file_open_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#if SB_API_VERSION < 16

#include <sys/stat.h>

#include <iomanip>
Expand Down Expand Up @@ -165,3 +167,5 @@ TEST(SbFileOpenTest, OpenOnlyDoesNotOpenNonExistingStaticContentFile) {
} // namespace
} // namespace nplb
} // namespace starboard

#endif // SB_API_VERSION < 16
1 change: 1 addition & 0 deletions third_party/boringssl/src/crypto/bio/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ BIO *BIO_new_file(const char *filename, const char *mode) {
#if defined(OPENSSL_SYS_STARBOARD)
SbFile sb_file = kSbFileInvalid;
SbFileError error = kSbFileOk;
int file = open(filename, SbFileModeStringToFlags(mode));
sb_file = SbFileOpen(filename, SbFileModeStringToFlags(mode), NULL, &error);
if (!SbFileIsValid(sb_file)) {
OPENSSL_PUT_SYSTEM_ERROR();
Expand Down

0 comments on commit e0f8599

Please sign in to comment.