From: ager@chromium.org Date: Fri, 5 Sep 2008 07:46:32 +0000 (+0000) Subject: Applied Rafal Krypa's patch to fix gcc 4.3.2 build problems. X-Git-Tag: upstream/4.7.83~25461 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1dba6feed0edab6a47f1e0c791b6ed9f278470c7;p=platform%2Fupstream%2Fv8.git Applied Rafal Krypa's patch to fix gcc 4.3.2 build problems. git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@149 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..820aa04 --- /dev/null +++ b/AUTHORS @@ -0,0 +1,9 @@ +# Below is a list of people and organizations that have contributed +# to the v8 project. Names should be added to the list like so: +# +# Name/Organization + +Google Inc. + +René Rebe +Rafal Krypa diff --git a/src/platform-linux.cc b/src/platform-linux.cc index e19faad..8b643fa 100644 --- a/src/platform-linux.cc +++ b/src/platform-linux.cc @@ -256,7 +256,11 @@ OS::MemoryMappedFile* OS::MemoryMappedFile::create(const char* name, int size, void* initial) { FILE* file = fopen(name, "w+"); if (file == NULL) return NULL; - fwrite(initial, size, 1, file); + int result = fwrite(initial, size, 1, file); + if (result < 1) { + fclose(file); + return NULL; + } void* memory = mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, fileno(file), 0); return new PosixMemoryMappedFile(file, memory, size); @@ -285,11 +289,14 @@ void OS::LogSharedLibraryAddresses() { addr_buffer[0] = '0'; addr_buffer[1] = 'x'; addr_buffer[10] = 0; - read(fd, addr_buffer + 2, 8); + int result = read(fd, addr_buffer + 2, 8); + if (result < 8) break; unsigned start = StringToLongLong(addr_buffer); - read(fd, addr_buffer + 2, 1); - if (addr_buffer[2] != '-') return; - read(fd, addr_buffer + 2, 8); + result = read(fd, addr_buffer + 2, 1); + if (result < 1) break; + if (addr_buffer[2] != '-') break; + result = read(fd, addr_buffer + 2, 8); + if (result < 8) break; unsigned end = StringToLongLong(addr_buffer); char buffer[MAP_LENGTH]; int bytes_read = -1; @@ -297,9 +304,8 @@ void OS::LogSharedLibraryAddresses() { bytes_read++; if (bytes_read >= MAP_LENGTH - 1) break; - int result = read(fd, buffer + bytes_read, 1); - // A read error means that -1 is returned. - if (result < 1) return; + result = read(fd, buffer + bytes_read, 1); + if (result < 1) break; } while (buffer[bytes_read] != '\n'); buffer[bytes_read] = 0; // There are 56 chars to ignore at this point in the line. @@ -309,6 +315,7 @@ void OS::LogSharedLibraryAddresses() { buffer[bytes_read] = 0; LOG(SharedLibraryEvent(buffer + 56, start, end)); } + close(fd); #endif } diff --git a/src/utils.cc b/src/utils.cc index 48ccc31..2f1c75a 100644 --- a/src/utils.cc +++ b/src/utils.cc @@ -104,7 +104,7 @@ char* ReadLine(const char* prompt) { char line_buf[256]; int offset = 0; bool keep_going = true; - fprintf(stdout, prompt); + fprintf(stdout, "%s", prompt); fflush(stdout); while (keep_going) { if (fgets(line_buf, sizeof(line_buf), stdin) == NULL) {