@@ -920,18 +920,29 @@ SlruReportIOError(SlruCtl ctl, int pageno, TransactionId xid)
920
920
path , offset )));
921
921
break ;
922
922
case SLRU_READ_FAILED :
923
- ereport (ERROR ,
924
- (errcode_for_file_access (),
925
- errmsg ("could not access status of transaction %u" , xid ),
926
- errdetail ("Could not read from file \"%s\" at offset %u: %m." ,
927
- path , offset )));
923
+ if (errno )
924
+ ereport (ERROR ,
925
+ (errcode_for_file_access (),
926
+ errmsg ("could not access status of transaction %u" , xid ),
927
+ errdetail ("Could not read from file \"%s\" at offset %u: %m." ,
928
+ path , offset )));
929
+ else
930
+ ereport (ERROR ,
931
+ (errmsg ("could not access status of transaction %u" , xid ),
932
+ errdetail ("Could not read from file \"%s\" at offset %u: read too few bytes." , path , offset )));
928
933
break ;
929
934
case SLRU_WRITE_FAILED :
930
- ereport (ERROR ,
931
- (errcode_for_file_access (),
932
- errmsg ("could not access status of transaction %u" , xid ),
933
- errdetail ("Could not write to file \"%s\" at offset %u: %m." ,
934
- path , offset )));
935
+ if (errno )
936
+ ereport (ERROR ,
937
+ (errcode_for_file_access (),
938
+ errmsg ("could not access status of transaction %u" , xid ),
939
+ errdetail ("Could not write to file \"%s\" at offset %u: %m." ,
940
+ path , offset )));
941
+ else
942
+ ereport (ERROR ,
943
+ (errmsg ("could not access status of transaction %u" , xid ),
944
+ errdetail ("Could not write to file \"%s\" at offset %u: wrote too few bytes." ,
945
+ path , offset )));
935
946
break ;
936
947
case SLRU_FSYNC_FAILED :
937
948
ereport (data_sync_elevel (ERROR ),
0 commit comments