@@ -128,6 +128,7 @@ static jrd_file* setup_file(Database*, const PathName&, const int, const bool, c
128128static void lockDatabaseFile (int & desc, const bool shareMode, const bool temporary,
129129 const char * fileName, ISC_STATUS operation);
130130static bool unix_error (const TEXT*, const jrd_file*, ISC_STATUS, FbStatusVector* = NULL );
131+ static bool block_size_error (const jrd_file*, off_t , FbStatusVector* = NULL );
131132#if !(defined HAVE_PREAD && defined HAVE_PWRITE)
132133static SLONG pread (int , SCHAR*, SLONG, SLONG);
133134static SLONG pwrite (int , SCHAR*, SLONG, SLONG);
@@ -553,6 +554,8 @@ void PIO_header(thread_db* tdbb, UCHAR* address, int length)
553554 break ;
554555 if (bytes < 0 && !SYSCALL_INTERRUPTED (errno))
555556 unix_error (" read" , file, isc_io_read_err);
557+ if (bytes >= 0 )
558+ block_size_error (file, bytes);
556559 }
557560
558561 if (i == IO_RETRY)
@@ -764,6 +767,8 @@ bool PIO_read(thread_db* tdbb, jrd_file* file, BufferDesc* bdb, Ods::pag* page,
764767 break ;
765768 if (bytes < 0 && !SYSCALL_INTERRUPTED (errno))
766769 return unix_error (" read" , file, isc_io_read_err, status_vector);
770+ if (bytes >= 0 )
771+ return block_size_error (file, offset + bytes, status_vector);
767772 }
768773
769774 if (i == IO_RETRY)
@@ -1033,16 +1038,47 @@ static bool unix_error(const TEXT* string,
10331038 Arg::Gds (operation) << Arg::Unix (errno);
10341039
10351040 if (!status_vector)
1036- {
10371041 ERR_post (err);
1038- }
10391042
10401043 ERR_build_status (status_vector, err);
10411044 iscLogStatus (NULL , status_vector);
10421045
10431046 return false ;
10441047}
10451048
1049+
1050+ static bool block_size_error (const jrd_file* file, off_t offset, FbStatusVector* status_vector)
1051+ {
1052+ /* *************************************
1053+ *
1054+ * b l o c k _ s i z e _ e r r o r
1055+ *
1056+ **************************************
1057+ *
1058+ * Functional description
1059+ * DB block read incomplete, that may be
1060+ * due to signal caught or unexpected EOF.
1061+ *
1062+ **************************************/
1063+ struct stat st;
1064+ if (os_utils::fstat (file->fil_desc , &st) < 0 )
1065+ return unix_error (" fstat" , file, isc_io_access_err, status_vector);
1066+
1067+ if (offset < st.st_size ) // we might read more but were interupted
1068+ return true ;
1069+
1070+ Arg::Gds err (isc_io_error);
1071+ err << " read" << file->fil_string << Arg::Gds (isc_block_size);
1072+
1073+ if (!status_vector)
1074+ ERR_post (err);
1075+
1076+ ERR_build_status (status_vector, err);
1077+ iscLogStatus (NULL , status_vector);
1078+ return false ;
1079+ }
1080+
1081+
10461082#if !(defined HAVE_PREAD && defined HAVE_PWRITE)
10471083
10481084/* pread() and pwrite() behave like read() and write() except that they
0 commit comments