On Wed, 6 Oct 2021 04:09:32 GMT, Ioi Lam <ik...@openjdk.org> wrote:

>> Yumin Qi has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   Added a helper class to facilitate checking archive
>
> src/hotspot/share/cds/filemap.cpp line 1099:
> 
>> 1097:     lseek(_fd, _header->_base_archive_path_offset, SEEK_SET); // 
>> position to correct offset.
>> 1098:     size_t n = os::read(_fd, *target, (unsigned int)name_size);
>> 1099:     if (n != name_size) {
> 
> I think there's no need to do another read. The base name string is already 
> inside the buffer that was read on line 1079. You can just do a `strncpy` 
> into `*target`

FileHeaderHelper only read sizeof(GenericCDSFileMapHeader) which is the stable 
information for reading other information and checking the archive. It does not 
include name in the buffer.

-------------

PR: https://git.openjdk.java.net/jdk/pull/5768

Reply via email to