mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-27 01:51:59 +00:00
Fix style and add check for seekability
This commit is contained in:
parent
cb975e6d4a
commit
0f584c3e76
@ -502,7 +502,13 @@ Pipe StorageFile::read(
|
||||
{
|
||||
if (S_ISREG(this_ptr->table_fd))
|
||||
{
|
||||
if (lseek(this_ptr->table_fd, this_ptr->table_fd_init_offset, SEEK_SET) < 0) {
|
||||
if (this_ptr->table_fd_init_offset < 0)
|
||||
{
|
||||
throw Exception("File descriptor isn't seekable, inside " + this_ptr->getName(), ErrorCodes::CANNOT_SEEK_THROUGH_FILE);
|
||||
}
|
||||
int seekable_table_fd = dup(this_ptr->table_fd);
|
||||
if (lseek(seekable_table_fd, this_ptr->table_fd_init_offset, SEEK_SET) < 0)
|
||||
{
|
||||
throw Exception("File descriptor isn't seekable, inside " + this_ptr->getName(), ErrorCodes::CANNOT_SEEK_THROUGH_FILE);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user