Skip to content

Commit

Permalink
SB<16 fixes
Browse files Browse the repository at this point in the history
Change-Id: I91474d7133ddcd3eea16b4ffd7b4705451acb168
  • Loading branch information
madhurajayaraman committed Jun 6, 2024
1 parent a046181 commit 51da995
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 13 deletions.
6 changes: 2 additions & 4 deletions cobalt/media/sandbox/fuzzer_app.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ void FuzzerApp::RunFuzzingLoop() {
for (int i = 0; i < number_of_iterations_; ++i) {
for (FileEntries::iterator iter = file_entries_.begin();
iter != file_entries_.end(); ++iter) {
LOG(INFO) << "Fuzzing \"" << iter->first << "\" "
<< "with seed " << iter->second.fuzzer.seed();
LOG(INFO) << "Fuzzing \"" << iter->first << "\" " << "with seed "
<< iter->second.fuzzer.seed();

Fuzz(iter->first, iter->second.fuzzer.GetFuzzedContent());
iter->second.fuzzer.AdvanceSeed();
Expand Down Expand Up @@ -122,8 +122,6 @@ void FuzzerApp::CollectFiles(const std::string& path_name, double min_ratio,
if (entry.size() < kSbFileMaxName || !directory || !entry.data()) {
break;
}
struct dirent dirent_buffer;
struct dirent* dirent;
int result = readdir_r(directory, &dirent_buffer, &dirent);
if (result || !dirent) {
break;
Expand Down
2 changes: 0 additions & 2 deletions net/cert/internal/trust_store_in_memory_starboard.cc
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@ std::unordered_set<std::string> GetCertNamesOnDisk() {
if (dir_entry.size() < kSbFileMaxName || !sb_certs_directory || !dir_entry.data()) {
break;
}
struct dirent dirent_buffer;
struct dirent* dirent;
int result = readdir_r(sb_certs_directory, &dirent_buffer, &dirent);
if (result || !dirent) {
break;
Expand Down
3 changes: 1 addition & 2 deletions starboard/loader_app/app_key_files.cc
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,14 @@ bool AnyGoodAppKeyFile(const std::string& dir) {

bool found = false;
std::vector<char> filename(kSbFileMaxName);

struct dirent dirent_buffer;
struct dirent* dirent;

while (true) {
if (filename.size() < kSbFileMaxName || !directory || !filename.data()) {
break;
}
struct dirent dirent_buffer;
struct dirent* dirent;
int result = readdir_r(directory, &dirent_buffer, &dirent);
if (result || !dirent) {
break;
Expand Down
2 changes: 0 additions & 2 deletions starboard/loader_app/installation_manager_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,6 @@ class InstallationManagerTest : public ::testing::TestWithParam<int> {
!dir_entry.data()) {
break;
}
struct dirent dirent_buffer;
struct dirent* dirent;
int result = readdir_r(directory, &dirent_buffer, &dirent);
if (result || !dirent) {
break;
Expand Down
1 change: 0 additions & 1 deletion starboard/shared/linux/dev_input/dev_input.cc
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,6 @@ std::vector<InputDeviceInfo> GetInputDevices() {
if (result || !dirent) {
break;
}
// starboard::strlcpy(entry.data(), dirent->d_name, entry.size());

std::string path = kDevicePath;
path += "/";
Expand Down
5 changes: 3 additions & 2 deletions third_party/musl/src/starboard/dirent.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "starboard/directory.h"
#include "starboard/file.h"

// copied from starboard/common/string.h
int strlcpy_dirent(char* dst, const char* src, int dst_size) {
for (int i = 0; i < dst_size; ++i) {
if ((dst[i] = src[i]) == 0) // We hit and copied the terminating NULL.
Expand Down Expand Up @@ -62,8 +63,8 @@ int readdir_r(DIR* dir, struct dirent* dirent_buf, struct dirent** dirent){
return -1;
}
char* out_entry = (char*)(malloc(sizeof(char[256])));
if (SbDirectoryGetNext(dir->dir, out_entry, kSbFileMaxName)){
strlcpy_dirent((*dirent)->d_name, out_entry, kSbFileMaxName);
if (SbDirectoryGetNext(dir->dir, (*dirent)->d_name, kSbFileMaxName)){
// strlcpy_dirent((*dirent)->d_name, out_entry, kSbFileMaxName);
return 0;
}
dirent = NULL;
Expand Down

0 comments on commit 51da995

Please sign in to comment.